XMLHTTP special characters


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: XMLHTTP special characters

  1. #1
    Murray Foxcroft Z.A. Guest

    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>"
    %>






  2. #2
    Fredrik Guest

    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>"
    > %>
    >
    >
    >
    >
    >




  3. #3
    Join Date
    May 2007
    Posts
    1

    Same problem

    Hi,

    I am also facing the same problem?
    have you got any solution?

    Thanks
    Hem

  4. #4
    Join Date
    Jun 2007
    Posts
    1

    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center