-
XMLHTTP special characters
I've tried numberous options to get XMLHTTP to work properly with special
characters but alas, to no avail. I use the following code and it fails to
load the xml
in the responseXML object although the ResponseText is populated but with a
square where the special character is.
If I replace the special character é with E or A or any normal alpha
character,
it works like a charm. Any help, please, I've tried everything I can think
of !
-----------------
Client Side
-----------------
// Open up a xmlhttp object for posting (sending) the xml to update the
database
xmlhttp.Open("POST", http://testbed21/pages/fund/ValueGet.asp", false);
xmlhttp.setRequestHeader("Content-Type", "text/xml");
xmlhttp.setRequestHeader("charset", "utf-8");
xmlhttp.send( '<anything>a</anything>' );
alert(xmlhttp.responseXML.xml);
-----------------
Server Side
-----------------
<%@language=VBScript%>
<%
Response.ContentType = "text/xml"
Response.CharSet = "UTF-8"
Response.Write "<specialchar> é </specialchar>"
%>
-
Re: XMLHTTP special characters
Seeing that you got no respons. I have no knowledge about this XMLHTTP, but
the problem could be that you do not actually send the data encoded as
utf-8. It might be in Ansi or whatever string/file encoding you use. And
then it will not be able to use characters high than 127 in the ASCII code.
The solution is to esnure that your stream/file/string or whatever it is you
are sending the XML code as actually has utf-8 encoding. The best way for a
file is to store it in a text editor that has encodings as an option. In a
stream you have to add the code jey for utf-8 first to the stream. If its a
string I have no idea what to do since the strings encoding might be fixed.
Cheers
Fredrik Svensson
"Murray Foxcroft Z.A." <foxman@xsinet.co.za> escribió en el mensaje
news:3cc90aa7@10.1.10.29...
> I've tried numberous options to get XMLHTTP to work properly with special
> characters but alas, to no avail. I use the following code and it fails to
> load the xml
> in the responseXML object although the ResponseText is populated but with
a
> square where the special character is.
>
> If I replace the special character é with E or A or any normal alpha
> character,
> it works like a charm. Any help, please, I've tried everything I can think
> of !
>
> -----------------
> Client Side
> -----------------
> // Open up a xmlhttp object for posting (sending) the xml to update the
> database
> xmlhttp.Open("POST", http://testbed21/pages/fund/ValueGet.asp", false);
> xmlhttp.setRequestHeader("Content-Type", "text/xml");
> xmlhttp.setRequestHeader("charset", "utf-8");
> xmlhttp.send( '<anything>a</anything>' );
>
> alert(xmlhttp.responseXML.xml);
>
> -----------------
> Server Side
> -----------------
> <%@language=VBScript%>
> <%
> Response.ContentType = "text/xml"
> Response.CharSet = "UTF-8"
> Response.Write "<specialchar> é </specialchar>"
> %>
>
>
>
>
>
-
Same problem
Hi,
I am also facing the same problem?
have you got any solution?
Thanks
Hem
-
Try this
XmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
XmlHttp.setRequestHeader("Content-Type", "text/xml; charset=iso-8859-9");
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks