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


On Mon, 09 Jun 2008 05:38:24 +0200, Cameron McCormack <cam@mcc.id.au>  
> 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()?


On Tue, 10 Jun 2008 01:42:30 +0200, Cameron McCormack <cam@mcc.id.au>  
> 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
Received on Thursday, 12 June 2008 12:53:25 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:09 UTC