How to convert XMLCh* to std::wstring?

Discussion in 'XML' started by Meal, Jul 18, 2007.

  1. Meal

    Meal Guest

    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.
     
    Meal, Jul 18, 2007
    #1
    1. Advertising

  2. 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...

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, Jul 19, 2007
    #2
    1. Advertising

  3. Meal

    Meal Guest

    On Jul 18, 10:33 pm, Joe Kesselman <> wrote:
    > 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...
    >
    > --
    > () ASCII Ribbon Campaign | Joe Kesselman
    > /\ Stamp out HTML e-mail! | System architexture and kinetic poetry


    Well, I'm talking about Xerces C++ parser.
     
    Meal, Jul 20, 2007
    #3
  4. Meal wrote:
    >> But not all XML parsers support all XML encodings.

    > 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.


    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, Jul 20, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. red floyd
    Replies:
    1
    Views:
    4,612
    Ron Natalie
    Oct 15, 2003
  2. He Shiming
    Replies:
    8
    Views:
    4,896
    Stephen Howe
    Jan 3, 2005
  3. Replies:
    14
    Views:
    4,424
    Phlip
    Aug 3, 2006
  4. Jeffrey Walton
    Replies:
    10
    Views:
    956
    Mathias Gaunard
    Nov 26, 2006
  5. Peter Poulsen
    Replies:
    5
    Views:
    715
Loading...

Share This Page