[Twisted-web] Encoding bug in Safari's XMLHttpRequest
James Y Knight
foom at fuhm.net
Fri Feb 11 11:42:08 MST 2005
On Feb 11, 2005, at 12:24 PM, David Remahl wrote:
> How would people feel about cluttering liveevil.js with code for
> checking for WebKit versions up to and including the current one, and
> attempt to re-interpret the string as UTF-8 if found?
>
> A version check and then something along the lines of _from_utf8() on
> <http://homepage3.nifty.com/aokura/jscript/utf8.html> should do it,
> but that would add dozens of lines to the beautifully simple script...
My opinion is that livepage should do what it has to, in order to work
with existing browsers.
I have one suggestion for this case, though: don't do a version check,
send a known "magic string" from server->client when first establishing
the request. E.g. a single Unicode character. If the browser gets that
known character, you're okay. If it shows up as two ISO8859-1
characters that are the UTF-8 encoding of the known character, apply
from_utf8. If it's something else entirely, die with an error message.
James
More information about the Twisted-web
mailing list