[xml] question about encoding



I try to create document with the encoding ISO-8859-1.
I did like:
   doc = xmlNewDoc((xmlChar*)"1.0"); 
   doc->encoding = xmlStrDup((xmlChar*)"ISO-8859-1"); 

I tried to add a property to a node with:
   xmlSetProp(node, (xmlChar*)"town", (xmlChar*)"München");

Everything works quite good, till I try to save the document
with xmlSaveFile or xmlSaveFileEnc with the encoding ISO-8859-1.
Then I get the error:
   xmlSaveFileEnc: document not in UTF-8

Then I read the document about the internalization-support of libxml but 'm
not sure if I understood it right.

Is it necessary to convert every string to UTF-8, befor I can use ist in a
function like xmlSetProp?

In another message I found, that there are functions like isolat1ToUTF8 and
UTF8Toisolat1. They are public defined but not in the headerfile. Should I
use this functions for the conversions?

Is it right, that I have to convert the strings also, when I read them from
the document e.g. with xmlGetProp?

Is there an easier way to work with document not encoded in UTF-8 than
calling the conversion-functions before and after the libxml-functions?

Thomas


-- 
Sent through GMX FreeMail - http://www.gmx.net





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