Re: XMLHttpRequest: BOM detection for responseText

On Fri, 18 May 2007 10:10:23 +0200, Alexey Proskuryakov  
<ap-carbon@rambler.ru> wrote:
> I'm not quite sure about having two separate variables for both  
> "charset" and "charset-http". If I'm not mistaken, the algorithm can be  
> streamlined by using only one of these:

I combined them now based on your feedback. Thanks!


> [...]
>
> 3. If there is no Content-Type header or there is a Content-Type header
> which contains a MIME type that is text/xml, application/xml, text/xsl or
> ends in +xml (ignoring any parameters) use the rules set forth in the XML
> specification to determine the character encoding. Let charset be the
> determined character encoding ***and terminate these steps***.

The steps are about returning a value for the text response entity body so  
we can't terminate them at this point.


> 4. If charset is "null" and the Content-Type MIME type contains a charset
> parameter let charset be the value of that parameter.

Shouldn't the charset parameter always overwrite everything?


> [...]
>
> I think step 5 (BOM detection) could be written in a declarative manner
> similar to how it is defined in CSS
> <http://www.w3.org/TR/CSS21/syndata.html#q23>. The current algorithm may  
> be slightly misguiding in that it misses some edge cases (what to do if  
> the
> reply is shorter than 4 bytes?) that should only be interesting to
> implementors anyway.

I tried to improve this:  
http://dev.w3.org/cvsweb/~checkout~/2006/webapi/XMLHttpRequest/Overview.html?content-type=text/html;%20charset=utf-8#text-response-entity-body


-- 
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>

Received on Sunday, 20 May 2007 01:55:56 UTC