Re: utf8 php howto?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> In some circumstances, with "mixed" charsets on a page, and with IE in 
>> quirks mode, IE will try to "guess" the charset and get it (very) 
>> wrong.
>
> A single page or response can only have one characterset, there is no 
> mixing possible.

Allow me to re-explain.

Step 1.
Generate HTTP headers that claim your document is UTF-8.

Step 2.
Generate some really bad HTML

Step 3.
Don't include a DOCTYPE

[At this point, IE is in quirks mode, and assumes your charset in the HTTP headers is meaningless, because you clearly don't know what you are doing.]
Step 4.
Make the first N-bytes of innerHTML English ASCII, then quote something in non-ASCII in one language, then something else in another.

IE will attempt to GUESS what charset to use, based on a heuristic evaluation of the bytes of innerHTML content.

IE being IE, it will guess WRONG, sometimes.

I spent the better part of a week working through this one time.

I had zero control over fixing the Content or validating the HTML or getting a DOCTYPE on it, for "corporate" reasons far too complex to go into here.

I did have a way to cram in the META HTTP-EQUIV tag, which finally convinced IE that it really really was UTF-8, despite it being in quirks mode.

I cannot now produce the HTML/URL in question, at least not readily, nor am I sure any more what version of IE it was, since it was at a job in a bug reporting system I no longer have access to.

You're just going to have to trust me that after I set up the same HTML on my OWN server just so I could tweak it by hand to go through all the permutations, I am quite convinced that this was a reproducible and consistent, if wacky, behaviour.

I probably still have that copy of the document around on my own server, somewhere, though where I have it is a bit of a poser, and I can't access my own server from my current day job, so there it is.

Dunno why MSIE trusts a META tag more than an HTTP header, but it "fits" the MS mind-set if you Zen on that enough.
[Be careful not to think on it too much and get sucked in...]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux