mail usprint this pagerss feed

www.liip.ch

Liip is hiring!

Firefox 3.0.4 and even more issues with the encoding in XMLHttpRequest

You may remember the problems we had with Firefox 3.0.0 and the encoding in XMLHttpRequest back in June. The Firefox team now tried to fix it (Issue 431701 in their Bugzilla), but failed miserably, they made the problem worse (unintentially, of course :)). While it was technically correct before, now it's not even that, as it still sends ISO-8859-1 encoded content, while it claims it's UTF-8 under some circumstances. The bug reports claim, that it only happens on non-US versions of firefox, but that doesn't help us much. This new regression is tracked at #464958, is already fixed and should be in Firefox 3.0.5, which is due around mid-December. With the auto-update feature of Firefox, a lot of our users will have updated to 3.0.4 and can't really wait until mid-December, so we had to find a workaround...

As it is really a bug this time and not just a different implementation of the problem, a correct and beautiful solution can't be done, so we had to fall back to some ugly trickery. When the DOM Parser can't read the XML string due to malformed UTF-8, we check, if it could be an ISO-8859-1 string and convert that to UTF-8. If it then still doesn't work, we just tell the parser to disregard all invalid UTF-8 characters as a last resort (The patch).

I currently see no other decent way to tackle this problem. "If it's not UTF-8, even if it claims to be, assume that it could be ISO-8859-1 and try with that" seems to be an ok-ish idea here in the Western Europe Alphabet World. Anyone else should maybe really wait with the upgrade until Firefox 3.0.5 is ready.

Related Entries:
Encoding issue with XMLHttpRequest and Firefox 3
whereami extension: now privacy enabled
the whereami firefox extension
Javascript 2.0
webtuesday: Scripters UTF-8 Survival Guide
Comments (2) |  Permalink

Comments

Matthias @ 09.01.2009 15:03 CEST
Ha! This is exactly the problem we're encountering with one of our scripts. Now all I have to do is understand that code of yours :-).
shit of @ 10.01.2009 18:42 CEST
2 days finding possibles errors on database and every more...
firefox is being internet explorer

add a comment

Your email adress will never be published.
Comment spam will be deleted!

For Spammers Only
Name*
E-Mail
URL
Comment*
Notify me via E-Mail when new comments are made to this entry
Remember me (needs cookies)