How to convert XMLCh* to std::wstring?

M

Meal

I put a chinese character into the XML file, and use
const XMLCh* xvalue = personNoteNode->getFirstChild()->getNodeValue()
to get the string.
The begining of the string is English, and in the memory they are
correctly represented as wide chars.
But the last Chinese character is represented as "3f00", which is a
wide '?'.
So the information has been lost after this statement, I think.
System is windows XP pro, and Chinese characters can be correctly
displayed in other applications.
 
J

Joe Kesselman

Make sure the document specifies the correct encoding in its XML
Declaration, and make sure the parser you're using actually supports
that encoding.

But not all XML parsers support all XML encodings. If yours doesn't, you
may want to try pre-converting the file to UTF8 or UTF16, and correcting
the declaration appropriately. If that still doesn't do the job,
complain to that parser's authors...
 
M

Meal

Make sure the document specifies the correct encoding in its XML
Declaration, and make sure the parser you're using actually supports
that encoding.

But not all XML parsers support all XML encodings. If yours doesn't, you
may want to try pre-converting the file to UTF8 or UTF16, and correcting
the declaration appropriately. If that still doesn't do the job,
complain to that parser's authors...

Well, I'm talking about Xerces C++ parser.
 
J

Joe Kesselman

Meal said:
Well, I'm talking about Xerces C++ parser.

I believe Xerces has to be linked with specific support libraries if you
want anything beyond the most basic encodings... but it's been years
since I looked at that, so I suggest you contact the Xerces folks and
ask them. Xerces-C has its own dedicated mailing list; you can find
information about that at http://xml.apache.org.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top