Re: [XHR] Sending a Document with a mismatched encoding

Note: due to the W3C policies our mailing list changed. You're undoubtedly  
aware of this phenomenon. I cc'ed the new list.

On Mon, 09 Jun 2008 05:29:01 +0200, Cameron McCormack <cam@mcc.id.au>  
wrote:
> It seems to be possible to send a Document using XHR where the encoding
> specified by the Content-Type charset parameter differs from the actual
> encoding used to encode the serialisation.  For example by:
>
>   var r = new XMLHttpRequest();
>   r.open("POST", "somewhere");
>   r.setRequestHeader("Content-Type", "application/xml;charset=US-ASCII");
>   var doc = document.implementation.createDocument(null, "á", null);
>   r.send(doc);
>
> Since passing a String to send() will cause the charset to be fixed up
> to match the actual encoding used (UTF-8, in that case), shouldn’t
> passing a Document to send() do the same?

Done.


On Mon, 09 Jun 2008 05:38:24 +0200, Cameron McCormack <cam@mcc.id.au>  
wrote:
> For that matter, how about defaulting to sending
>
>   Content-Type: text/plain; charset=UTF-8
>
> if a String is passed to send() without a Content-Type having been given
> by setRequestHeader()?

Done.


On Tue, 10 Jun 2008 01:42:30 +0200, Cameron McCormack <cam@mcc.id.au>  
wrote:
> If the Content-Type header has to be fixed up to match the encoding
> being used to send a String, what should happen if the user-specified
> header is malformed?

If the header value is malformed nothing is done.


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

Received on Thursday, 12 June 2008 12:53:25 UTC