[
Lists Home |
Date Index |
Thread Index
]
On 4/21/06, andrew welch <andrew.j.welch@gmail.com> wrote:
> This file:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE html
> PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html>
> <head>
> <title>test char 150</title>
> </head>
> <body>
> <p>x–x</p>
> <p>Should see xx and not x dash x</p>
> </body>
> </html>
>
> Displays as x dash x (x-x) on both Windows and Mac, using IE, Firefox
> and Safari.
>
> If I've read it correctly, character 0x96 (#150) is only ever a dash
> in Windows-1252 (ANSI) whereas in Unicode it's a non-displayed control
> character.
>
> In the XML spec it states that the parser must only resolve character
> references using Unicode - so why do the browsers render #150 as a
> dash?
>
> I could understand IE doing it (always using a HTML parser), but not
> Firefox which (afaik) parses XHTML pages with an XML parser. Is it
> that the use of ANSI is so widespread that the browsers knowingly
> break the spec and render them anyway (again, something I wouldnt have
> thought of FF)
When the correct mime type is used with Firefox, such as text/xml,
then it does parse the file using an XML parser and it does indeed
drop the #150 - so Firefox behaves as expected. It seems whenever an
HTML parser is used, it's perfectly ok to use C1 control characters
and expect them to be read using Windows 1252 numbers, regardless of
the charset used.
|