According to the W3C specification, XML http responses should always
use UTF-8 encoding (requests too actually)
http://www.w3.org/TR/XMLHttpRequest/

"Authors are strongly encouraged to encode their resources using UTF-8"

http://erik.eae.net/archives/2005/05/27/18.55.22/:
"UTF-8 is the standard encoding for XML files, so it MSXML probably
assumes that all files have that encoding if none is set."

http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060405/
"responseText of type DOMString
If the readyState attribute has a value other than 3 (Receiving) or 4
(Loaded), it must be the empty string. Otherwise, it must be the the
body of the data received so far, interpreted using the character
encoding specified in the response, or UTF-8 if no character encoding
was specified. Invalid bytes must be converted to U+FFFD REPLACEMENT
CHARACTER."
"If the method is POST or PUT, then the data passed to the send()
method must be used for the entity body. If data is a string, the data
must be encoded as UTF-8 for transmission. If the data is a Document,
then the document must be serialised using the encoding given by
data.xmlEncoding, if specified, or UTF-8 otherwise [DOM3]. If data is
not a Document or a DOMString the host language must use the
stringification mechanisms on the argument that was passed."

Basically from what I have seen in the google results, UTF-8 is the
XML standard and browsers are expecting AJAX to use UTF-8 for both
request and responses. It appears that Trinidad is honoring these
guidelines by forcing UTF-8 for XML responses (and other responses,
like file-download)

My question is why you are using windows-1252 encoding? What is the
"unavoidable reason"?

-Andrew


On Thu, Feb 11, 2010 at 6:07 AM, Cédric Durmont <cdurm...@gmail.com> wrote:
> Hi there,
>
> I was wondering : what's the reason why XmlHttpServletResponse forces
> the response to UTF-8, explicitly ignoring the page's encoding ?
> I had a project in utf-8 that ran just fine (even with all accents and
> fancy stuff we have here in France), but I have to switch it to
> windows-1252 for some unavoidable reason. Everything has been
> converted to windows-1252, including the filter I use to force
> encoding in http requests. The only non-working things are PPR calls.
>
> I tracked modifications of http Response objects down to
> XmlHttpServletResponse :
>
> ..
>   _contentType = "text/xml;charset=utf-8";
> ..
>
> So, did I miss something, or PPR actually only works for iso8859-1 /
> utf-8 apps ?
>
>
> Regards,
> Cedric Durmont
>

Reply via email to