Monday, October 16, 2006

Firefox and Unicode

Firefox (version 1.5.0.7 at least) is sometimes really stupid...
Scenario:
- file 1, HTML, saved in UNICODE (FFFE marker)
- file 2, CSS, saved in plain ANSI
- file 3, JS #1, saved in plain ANSI
- file 4, JS #2, saved in UNICODE (FFFE marker)
What would happend in Firefox? It will apply the UNICODE encoding from the HTML file to... all of the 4 files, resulting in the CSS and the JS #1 to be garbage after such decoding and therefore not usable by Firefox. Only the JS #2 is decoded OK since it is in the same UNICODE encoding in the first place.
I've found this after hours of "stupid debugging" (== change the code just to see "what if", even when you know the outcome)... My resolution? Save the HTML file in plain ANSI and... voila! It works!
All this time, Internet Explorer worked OK...

1 comment:

Anonymous said...

Still.

If you're using unicode text, like Japanese or other languages-

Firefox still refuses to cooperate.

You can't view Unicode languages without Unicode.

You can't view external JS & CSS WITH Unicode(with FF only.)

INTERNET EXPLORER FTW.