Quantcast

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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

peterhxandros
I'm having problems with Firefox 3 beta 5 when sending UTF-8
characters via an XMLHTTPRequest.

I have read the following page: http://developer.mozilla.org/en/docs/XMLHttpRequest
which states:
Note: Versions of Firefox prior to version 3 always send the request
using UTF-8 encoding; Firefox 3 properly sends the document using the
encoding specified by data.xmlEncoding, or UTF-8 if no encoding is
specified.
In my test example, I attempt to explicitly set the content-type
header to "text/xml;charset=utf-8", as well as verify that the
xmlEncoding is null.

However, when I view the request headers in FF3 I see:
Content-Type    text/xml; charset=ISO-8859-1
and the content on the server side is garbled

In FF2 I see:
Content-Type    text/xml;charset=UTF-8
and t content is correctly encoded as UTF-8 on the server side

Here's an example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script language="javascript">
        var dom = document.implementation.createDocument( "", "",
null );
        var element = dom.createElement( "content" );
        element.appendChild( dom.createTextNode( "üßäöüß" ) );
        dom.appendChild( element );
        var request = new XMLHttpRequest();
        var url ="someURL";
        request.open( "POST", url, true );
        request.setRequestHeader( "Content-Type", "text/
xml;charset=utf-8" );

        /* Firefox 3 should take it's cue from data.xmlEncoding,
according to
http://developer.mozilla.org/en/docs/XMLHttpRequest */
        alert( "xmlEncoding? " + dom.xmlEncoding );

        request.send( dom );
</script>
</head>
<body>
</body>
</html>

Does anyone have any idea on how to control this? Or how to set the
xmlEncoding property if necessary? Or what I'm doing wrong ;) ?

Thanks,

Peter
_______________________________________________
dev-i18n mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-i18n
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Jean-Marc Desperrier
[hidden email] wrote:
> I'm having problems with Firefox 3 beta 5 when sending UTF-8
> characters via an XMLHTTPRequest.
>
> I have read the following page: http://developer.mozilla.org/en/docs/XMLHttpRequest
> which states:
> Note: Versions of Firefox prior to version 3 always send the request
> using UTF-8 encoding; Firefox 3 properly sends the document using the
> encoding specified by data.xmlEncoding, or UTF-8 if no encoding is
> specified.  [...]

bz has updated this page (maybe after reading this message) to correct
it, it's data.inputEncoding that is used.

This is also what the current w3c draft says :
http://www.w3.org/TR/XMLHttpRequest/
_______________________________________________
dev-i18n mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-i18n
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

wafeneto
In reply to this post by peterhxandros
please does anyone have any idea of how
, using XMLHttpRequest send method,
should be te structure of a dom object to pass information to a server
and capture it in request object?

_______________________________________________
dev-i18n mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-i18n
Loading...