Re: XML encoding - handling foreign lang chars (SOLUTION)
My client creates an XML doc in memory. It sends the xmldoc.xml string to
an ASP on the server. The server does xmldoc.load(Request) and gets an error:
"An invalid character was found in the text context." because the XML contains
a foreign language character.
I tried having the client do an xmldoc.createProcessingInstruction and set
the encoding. Still got the error. Then I realized something.... xmldoc.xml
gives you a string that DOES NOT indicate the encoding!! SO, the encoding
was lost and the error continued.
Now I do this:
sXML = Replace(oXMLDoc.xml, "?>", " encoding=""ISO-8859-1""?>", 1, 1)
Which adds the encoding to the <?xml version="1.0" ?> statement at the beginning
of the doc (put there by the createProcessingInstruction). I send the sXML
string to the ASP and...
NOW IT WORKS!!! The xmldoc.load(Request) works without error!
1) xmldoc.save("somefile.xml") DOES indeed retain the encoding, but xmldoc.xml
2) I use the Internet Transfer Control to send my XML to the server because
the MSXML.XMLHTTPRequest requires IE and I don't want that requirement for
my users. I could not figure out which DLLs of IE are really needed by MSXML.XMLHTTPRequest
(its more than msxml.dll).
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center