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

[XHR] Request charset is limited to UTF-8 for x-www-form-urlencoded data

From: Yaroslav <yarosla@gmail.com>
Date: Mon, 23 Jun 2008 03:22:20 +0400
Message-ID: <131ad5f40806221622u3d3ca7a2s31a62c06dca43eaf@mail.gmail.com>
To: public-webapps@w3.org


In the current spec
(http://www.w3.org/TR/2008/WD-XMLHttpRequest-20080415/) I do not see
the possibility to POST application/x-www-form-urlencoded data with
charset other than UTF-8. I think this is limiting factor, which
should be avoided. UTF-8 is good versatile encoding but it is not
always practical to use it. When developing sites in Russian, for
example, we mainly use windows-1251 encoding, UTF-8 is rarely used as
it doubles network traffic.

The spec says:

> data is a DOMString
> Encode data using UTF-8 for transmission.
> If a Content-Type header is set using setRequestHeader() set the charset parameter of that header to UTF-8.

In my practice application/x-www-form-urlencoded data usually comes
from custom javascript encoding function (as DOMString). When sending
it to server over XHR I use setRequestHeader('Content-type',
'application/x-www-form-urlencoded; charset=windows-1251'). This
informs the server of the correct encoding. This all worked well until
FF3 followed the spec.

I think when the user explicitly sets charset with setRequestHeader()
the browser should not override that. UTF-8 should be used only as


Yaroslav Stavnichiy
Received on Monday, 23 June 2008 01:39:06 UTC

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