Re: Firefox 3 beta 5 - when sending XMLHTTPRequest, content-type request header is forced to ISO-8859-1 encoding instead of UTF-8

[email protected]
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <e7f55523-92ad-4d13-a61a-6e007bd6cb3d@t54g2000hsg.googlegroups.com>
On Apr 30, 12:41 pm, Boris Zbarsky <[email protected]> wrote:
> [email protected] wrote:
> > and the content on the server side is garbled
>
> Only if you decode it as UTF-8 without paying attention to what the data
> actually is, right?
>

Yes, thats right, I had assumed that all content is coming in as
UTF-8.

>
> I don't think you can change the encoding of an existing Document object.  You
> can create a document with an arbitrary encoding by using DOMParser on a string
> with the proper XML prolog, I would think.
>

Yes, I have implemented this using something similar to:
var domDocument = new DOMParser().parseFromString("<?xml version='1.0'
encoding='UTF-8'?><foobar/>","text/xml");
and everything works as desired, although I'm somewhat concerned about
the performance tradeoff between these two implementations.

A similar bug was raised under:
https://bugzilla.mozilla.org/show_bug.cgi?id=407213
May wish to mark as duplicate of 431701.

Thanks for your help.

-Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.