How to translate Japanese character contained in XML by XSL to HTML

Experts,

I have a problem.

I created a web interface which is required to allow japanese input and insert the text into SQL server 2000 DB.

The XML, returned by the SP that get data from DB, is able to retrieve the Japanese Text and showing them in my debug page, even without using nVarchar data type at Field.

However, seems my current XSL can not represent what we have got in the XML by display the gibberish like
は進行 ....

Now, on the header of my current XSL has this :

<xsl:output method="html" encoding="iso-8859-1" indent="yes" doctype-public="-//W3C//DTD HTML 3.2 Final//EN" />

And in this XSL file there're a lots of logic,switching between multiple Language (including japanese) based on the user profle, to display messages in those languages hard coded there.

Could you guys help me figure out a way to represent the Japanese Text from the Backend which already correctly contained in the XML in the current context.

Thanks

ca_rolandAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ramazanyichCommented:
the main problem here is defined encoding="iso-8859-1" attribute. It means that your japanese characters will not be shown because that encoding supports only western european character sets. In your case or it should be UTF-8 or it should be your japanese character encoding.
try to set:
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-public="-//W3C//DTD HTML 3.2 Final//EN" />


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rdcproCommented:
Well, you're sure not going to represent any Japanese characters using iso-8859-1.  What you're seeing is the processor trying to   It's no trouble at all using XSLT to simultaneously represent Japanese characters along with any other locale-specific characters.  Life would be a lot easier if you used Unicode; either UTF-16 or UTF-8.  If you have lots of asian characters, UTF-16 is more compact than UTF-8.  

<xsl:output method="html" encoding="utf-16" indent="yes" doctype-public="-//W3C//DTD HTML 3.2 Final//EN" />

or

<xsl:output method="html" encoding="utf-8" indent="yes" doctype-public="-//W3C//DTD HTML 3.2 Final//EN" />

As long as this XSLT outputs the entire HTML page (including HTML and HEAD tags),  your browser should be able to handle the encoding correctly.  If there are problems, you may have to add a meta tag to the HTML.  Make sure your web server, whatever it is, is using the same response encoding.  

I would still use nText and nVarChar in my database, though.

If you're still having problems, let me know.  Encoding issues can be a PITA to solve, but they are solveable.

Regards,
Mike Sharp
0
ca_rolandAuthor Commented:
Thank you for your quick response.

However, the updates of "encoding=" does not take any effects.

Again I got this in XML : <sChildTitle><![CDATA[&#12399;&#36914;&#34892;&#20013;&#12391;&#12377; ]]></sChildTitle>

However, after XSL processing I got : &#12399;&#36914;&#34892;&#20013; ....

Thank you in advance for our help.
0
ca_rolandAuthor Commented:
Sorry.

After submitting my comments the Japanese Text <sChildTitle> is changed.

Anyway, I did get Japanese there.

Thanks



0
rdcproCommented:
Oh, well this isn't going to get parsed into the characters at all:

<sChildTitle><![CDATA[&#12399;&#36914;&#34892;&#20013;&#12391;&#12377; ]]></sChildTitle>

Because of the CDATA section.  This will render the characters:

<sChildTitle>&#12399;&#36914;&#34892;&#20013;&#12391;&#12377;</sChildTitle>


Regards,
Mike Sharp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.