troubleshooting Question

XML and Character Encoding

Avatar of cochrag
cochrag asked on
XML
5 Comments1 Solution512 ViewsLast Modified:
Hi

I am trying to create a multilingual ASP site with support for ten different languages. I have placed the strings required to build the content for the site in individual xml files for each language. The format of these files is below:-

<?xml version="1.0" encoding="UTF-8" ?>
<language lang="en">
  <LANG1>String One</LANG1>
  <LANG2>String Two</LANG2>
</language>

for each page I am storing the strings I need for that page and then using them when necessary using the following vb code

<%set xmlDoc = server.createObject("Microsoft.XMLDOM")
    xmlDoc.async = false
    xmlDoc.load server.mapPath("../languages/"&strLanguage&"/strings.xml")
      AppName = xmlDoc.getElementsByTagName("LANG1")(0).text
%>

This all works fine or the english language file, but when I try to read in anything from the chinese or japanese files (or even accented characters from european languages) the non-english characters display as question marks.

Can anyone explain why this happens and what I need to do to prevent it? The encoding on the web page and in the xml documents are both declared as utf-8, and viewing the documents in the browser displays all characters fine as well. Being quite new to XML I am stumped.

Thanks
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros