libxml2 questions about xmlChar*
I'm using libxml2. All function are working with xmlChar*. I found that xmlChar is an unsigned char.
So I have some questions about how to work with it.
1) For example if I working with utf-16 or utf-32 file how libxml2 process it and returns xmlChar in function? Will I lose some characters then??
2) If I want to do something with this string, should I cast it to char* or wchar_t* and how??
Will I lose some characters?
xmlChar
is for handlingUTF-8
encoding only.So, to answer your questions:
No, you won't loose any characters if using
UTF-16
orUTF-32
. Just use iconv or any other library to encode yourUTF-16
orUTF-32
data before passing it to the API.Do not just "cast" the string. Convert them if needed in some other encoding.