It seems as though &nbsp; gets replaced by an actual non-breaking space within a code section in the final output. I think this was not always the case (can someone confirm?), and it generally contradicts the meaning of a code section.

This is also inconsistent with the way text within backticks is treated. Now I know I could circumvent that by using &amp;nbsp;, but I'm very hesitant of this double encoding of source code.

Refresh this page, and watch the first code block in the question: you can see the &nbsp; get changed to a space!
–
BlorgbeardJul 8 '09 at 5:14

@Blorgbeard: Definitely a client-side bug. Strange but I've missed this glitch so far. Chances are that this will never be fixed since it would instantly invalidate all those "work-arounded" code samples.
–
TomalakJul 8 '09 at 7:10

So if I had to guess then I'd say that this is one of the bugs that can never be fixed because there is an unknown number of code samples that are built around it. They would instantly become invalid.
–
TomalakJul 8 '09 at 7:13

@Tomalak ​ It only means that people will have to edit them, when the find them.
–
Brad GilbertAug 14 '09 at 15:19

@Brad Gilbert: You could look at it that way, yes. But it also means that code will be subtly wrong for J. Random Coder, who finds the page through Google. Which is sub-optimal.
–
TomalakAug 25 '09 at 13:38

The first is &nbsp; and the second is &amp;nbsp;. (I've used an extra level of entification to type the preceding sentence, and hope that it still comes out right when I post it.) Really nasty is that the preview initially shows the code as typed, but then replaces it with a space when it syntax-colours it after some random interval.

The bug does seem to be peculiar to nbsp. I haven't found any other character code that does it.