Dan Tang
Dan Tang

Reputation: 1333

Converting Chinese UTF8 to readable string

I'm trying to convert Chinese characters in a XML file to readable Chinese string using javascript, but I'm not sure how to. I have checked other SO posts, and tried the following

unescape(encodeURIComponent('丘'))

but still can't get it to work, and wondering if someone could help?

<utf8>&#x4E18;</utf8>

Upvotes: 0

Views: 359

Answers (1)

Bergi
Bergi

Reputation: 664425

Neither unescape nor encodeURIComponent (which deal with percent-encoding) will help you with a XML character entity. You just want to parse the XML file! Accessing the DOM then will yield the expected string.

Upvotes: 1

Related Questions