Can libxml be used with unicode xmlchar?

Can libxml be used with unicode?

For example, the xmlParseDoc function takes xmlChar

xmlChar has the following definition:

typedef unsigned char xmlChar;

      

I would like libxml to interpret everything as 2 byte characters.

I got a feeling that the following would not work with lib:

typedef unsigned short xmlChar;

      

Note. I'm not talking about when it actually reads / writes the xml encoding. I know it supports unicode. I want the interface in lib to be with unicode wstrings instead of normal strings.

+1


source to share


1 answer


I found the answer in the link provided by @Mitch Wheat

You cannot override xmlchar as unsigned short. However, if you encode your strings as UTF-8 then xmlChar will handle unicode correctly.



You can convert string to windows to UTF8 by calling WideCharToMultiByte with CP_UTF8 parameter

+4


source







All Articles