# Preview incorrectly renders non-entities as entities

System: Mac OS X, Browser: Firefox 15.0.1 (what other information is needed?).

&#211hello; produces Óhello; in the Preview. Similarly with hex: &#x211bhello; produces ℛhello;

(They render correctly when posted.)

-
What's the problem anyway? What do you expect them to look like? –  SingerOfTheFall Sep 13 '12 at 13:22
@SingerOfTheFall Sorry, thought that was obvious. &#211hello; should render as &#211hello; since it is not a valid entity. –  Loop Space Sep 13 '12 at 13:23
@SingerOfTheFall: They are invalid entities (&#xxx; is the proper format, where xxx is a decimal number). –  Martijn Pieters Sep 13 '12 at 13:24
What is interesting is that an extra ; is being implied by the preview. The problem, of course, is that this 'eager fixing' is going to hide your error until you submit your post. –  Martijn Pieters Sep 13 '12 at 13:25

Part of the responsibility falls on the browser, which I believe shouldn't technically do what it's doing by pretending there was a ; there.

That said, there's no reason that PageDown can't use the same level of strictness in its ampersand encoding that MarkdownSharp does, so updating _EncodeAmpsAndAngles to use

/&(?!#?[xX]?(?:[0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*);)/g


/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g