[Twisted-web] Encoding bug in Safari's XMLHttpRequest

Donovan Preston dp at ulaluma.com
Fri Feb 11 14:53:50 MST 2005


On Feb 11, 2005, at 10:42 AM, James Y Knight wrote:

>
> 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.

+1 on this; liveevil.js should abstract all of these problems away from 
the developer. If nobody else generates a patch, I will do one in the 
manner which James suggests some weekend soon.

dp




More information about the Twisted-web mailing list