W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2008

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

From: Anne van Kesteren <annevk@opera.com>
Date: Thu, 12 Jun 2008 14:52:19 +0200
To: "Cameron McCormack" <cam@mcc.id.au>, public-webapps@w3.org
Cc: "Boris Zbarsky" <bzbarsky@mit.edu>
Message-ID: <op.ucmzdhei64w2qv@annevk-t60.oslo.opera.com>

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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:25 GMT