Re: [xml] xmlChar * <-> char *

the PDF is not very clear.

I read both pages you sugested, and got a few more questions, but i
think i got the hang of it.

for example, at the begining of my program, i could set locales to
utf-8 (regardless of the OS enconding)

if (!setlocale(LC_ALL, "en_US.UTF-8"))
      exit EXIT_FAILURE;

and that would assure all my strings are in utf (making sure i dont
str functions that cant handle utf-8)
so in that scenario, "char *" would be the same as "xmlChar *",
alowing me to cast one to the other safely

i would love a real world, complete, example :S


On Sun, Nov 15, 2009 at 10:00 AM, Kuba <jastako gmail com> wrote:

Hi Carlos,

You should read xml tutorial available here:

Starting at 8th page there is a chapter called Encoding Conversion.

If tutorial wouldn't help msg me/us.

Futhermore there are plenty of resources about unicode (utf8/16/32). In very short, you can treat utf8 as 
way of coding chars in 1 byte-multiple convention. Chars most freqeuntly used are stored in less amount of 
bytes than less frequently used. There coding codes could be done by Huffman coding, where there is no 
character, which coding is the same as prefix of less frequently used character. In utf8 you are strongly 
using CODE PAGEs.

Helpful resources:

Best regards,

Carlos basura pisze:


im very new to xmllib, utf8 in C.
im writing a program that will read and write a xml formated config file for other app.
im my application, i use char * all over the place, except on the functions that read from a xmlreader, 
since the return value of this functions is xmlChar

now, if the library has this special type, its because is needed. is just that i dont get it.

some people at ##C in freenode told me to read about iconv, but it got me more confused ....

so i ask here. should i use xmlChar all arround my app?
should i use a "convert" function? then how is it called?

if you really want to look at it, im hosting my little project it in github

warning, the code is ugly as hell, im not only new to xml, but pretty much to C
any help on the matter will be greatly apreciated


xml mailing list, project page
xml gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]