Re: Always reports utf-8 encoding?

"Marco Forberg" <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <op.tgj2ewmv3odusb@anakin>
Did you try setting the encoding when creating the parser?
XML_ParserCreate("UTF-16")


Am 27.09.2006, 23:02 Uhr, schrieb Franky Braem <[email protected]>:

> I've compiled expat with XML_UNICODE to get UTF-16 encoding. But it
> seems that the character data handler always gets its information in  
> UTF-8.
> The xml-file is stored in UTF-16 format.
>
> This is what I do in the handler:
>
> void ModulesXMLParser::CharacterDataHandler(void *userData,
>                                             const XML_Char *s,
>                                             int len)
> {
>     ModulesXMLParser *modxml = (ModulesXMLParser *) userData;
>     for(int i = 0; i < len; i++)
>     {
>         const unsigned t = s[i];
>         modxml->m_chars.AppendByte(t);
>     }
>     //modxml->m_chars.AppendData((void *) s, len);
> }
>
> And this is how I convert the information stored in m_chars:
>
>     wxMBConvUTF16 conv;
>     modxml->m_chars.AppendByte('\0');
>     modxml->m_chars.AppendByte('\0');
>     wxString dllName = wxString((const char *)
> modxml->m_chars.GetData(), conv);
>
> The above doesn't work. The following works:
>
>     wxString dllName = wxString((const char *)
> modxml->m_chars.GetData(), wxConvUTF8);
>
> Any ideas on how to get UTF-16 output?
>
> Franky.
> _______________________________________________
> Expat-discuss mailing list
> [email protected]
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.