11

I copied a working piece of code to the comment under one of recent questions:

Histogram[
  RandomVariate[NormalDistribution[0, 1], 200], 
  LabelingFunction -> (Placed[NumberForm[#, {\[Infinity], 2}],   Above] &)
]

After copying it back it was not recognized as a correct input

enter image description here

enter image description here

Have I done something incorrectly?

11
  • Histogram[RandomVariate[NormalDistribution[0, 1], 200], LabelingFunction -> (Placed[NumberForm[#, {\[Infinity], 2}], Above] &)]
    – Kuba Mod
    Aug 17, 2016 at 11:13
  • The same happens with this code ^ but not the one from the question body.
    – Kuba Mod
    Aug 17, 2016 at 11:13
  • 1
    Bizarre. Happens in both V10.4 and V11 (Max OS X 10.11.6).
    – Michael E2
    Aug 17, 2016 at 12:00
  • @MichaelE2 which probably means the problem is on SE side.
    – Kuba Mod
    Aug 17, 2016 at 12:16
  • 7
    Yeah, it's an SE issue; SE inserts zero-width non-joiner non-printing characters between certain letters like i and o, r and i, and even # and ",". It's supposed to be used to prevent ligatures from forming, for example preventing "ae" from turning into "æ", but this must be a mistake.
    – C. E.
    Aug 17, 2016 at 13:05
  • 1
    That explains why some code I copied from comments didn't work, but when I re-typed it all was fine. I didn't investigate though.
    – Szabolcs
    Aug 17, 2016 at 13:09
  • 1
    @C.E. I know, SE team don't want people to answer in comments! :)
    – Kuba Mod
    Aug 17, 2016 at 13:11
  • 4
  • 1
    So this should work: Histogram[ RandomVariate[NormalDistribution[0, 1], 200], LabelingFunction -> ( Placed[NumberForm[#, {\[Infinity], 2}], Above] &)]
    – Kuba Mod
    Aug 17, 2016 at 13:29
  • but it does not.
    – Kuba Mod
    Aug 17, 2016 at 13:30
  • 2
    @Kuba The longest run in that is 35 characters. So perhaps something went wrong with SE recently.
    – Szabolcs
    Aug 17, 2016 at 13:58

2 Answers 2

10

To add to what @Szabolcs said, we made a change on Monday to accommodate non-English sites and reduced the interval between gaps to 20.

We since changed it to be every 20 characters, only after a sequence of 60 characters without any space or return. So this should be fixed. Note that this was only a rendering difference, so the original comments have never been altered and should be fine now.

Please double check if there are more edge cases, thanks!

0
8

To summarize the findings so far:

StackExchange does insert unicode characters U+200C (zero width non joiner) and U+200B (zero width space) into comments on occasion. Link to Meta.SE post. This is done for reasons related to how browsers do line breaking.

In the linked Meta.SE thread it is stated that this is done only when there is a run of at least 80 non-whitespace characters. However, in the examples shown under the post above, we don't have such a long run of non-whitespace characters! In @Kuba's comment the longest run is 35.

enter image description here

This makes me suspect that there is a recent change in how comments are handled. Perhaps a bug? It would be good to have an answer from the SE staff.

Incidentally, there was a question today about a non-working command which is broken exactly due to an invisible zero-width space. The OP claims that he didn't copy any part of that command from a comment, but the coincidence in timing makes me wonder ...

1
  • This was also a problem for math.SE, when people were posting long LaTeX expressions in comments and wondering why MathJax was failing on them. Aug 18, 2016 at 15:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .