You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Wentao Deng <we...@macadamian.com> on 2007/07/20 17:40:05 UTC

How to convert XMLCh* to std::wstring?

Hi,

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.

Regards,
Wentao


Re: How to convert XMLCh* to std::wstring?

Posted by Wentao Deng <we...@macadamian.com>.
Oh, thanks. You are right. The XML was saved in wrong encoding.

Regards,
Wentao


----- Original Message ----- 
From: "Alberto Massari" <am...@datadirect.com>
To: <c-...@xerces.apache.org>
Sent: Monday, July 23, 2007 5:01 AM
Subject: Re: How to convert XMLCh* to std::wstring?


> Hi Wentao,
> I guess that the original XML had an encoding declaration that is 
> incompatible with the Chinese character you inserted, or that the 
> editor you used to insert it ended up saving the XML in a format 
> different from the encoding declaration.
> E.g. you XML starts with <?xml version="1.0" encoding="utf-8"?> but 
> you used notepad to change it, and it saved it using Big-5
> 
> Alberto
> 
> At 11.40 20/07/2007 -0400, Wentao Deng wrote:
>>Hi,
>>
>>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.
>>
>>Regards,
>>Wentao
>

Re: How to convert XMLCh* to std::wstring?

Posted by Alberto Massari <am...@datadirect.com>.
Hi Wentao,
I guess that the original XML had an encoding declaration that is 
incompatible with the Chinese character you inserted, or that the 
editor you used to insert it ended up saving the XML in a format 
different from the encoding declaration.
E.g. you XML starts with <?xml version="1.0" encoding="utf-8"?> but 
you used notepad to change it, and it saved it using Big-5

Alberto

At 11.40 20/07/2007 -0400, Wentao Deng wrote:
>Hi,
>
>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.
>
>Regards,
>Wentao