Japanese breaks up XML (msxml2)
Posted on 2003-11-30
I have the following problem: I wrote a simple ASP script (see function below) that allows administrators of my website to update text strings in an XML file. This works perfectly for any unicode language, but not for Japanese. The file becomes totally corrupted and unreadable; in fact, is "cut" at the exact point where it should be normally updated.
I suppose the problem lies either in the fact that I use an old msxml parser (ver. 2) or because the Japanese encoding is set to shift-jis i.s.o. UTF-8.
Does anyone here have any experience with this problem, and a possible solution?
'XML UPDATE NODE VALUE
Function fncUpdateXML(strLanguage, strScriptName, strNode, strText)
Set xmlDoc = Server.CreateObject("msxml2.DOMDocument")
xmlDoc.async = False
If NOT xmlDoc.Load("c:\testfile.xml") Then
Response.Write "Page failed to load"
strText = Replace(strText, "<br>", vblf)
xmlDoc.SelectSingleNode("/languages/language[@xml:lang='" & strLanguage & "']/pages/page[@xml:page='" & strScriptName & "']/" & strNode).text = strText
Set xmlDoc = Nothing