[xml] iso-8859-1 problem



I'm confused on encoding support of libxml2. 
I can't solve my problem and I don't know why.
I parse a xml document (with iso-8859-1 encoding) and I have to add some elements to this document. I take 
the informations from db and these informations have latin1 characters (òèàù) and I save them in char*. Then 
I add the element with, for example, 

.......
if (titolo != NULL) {
    char* tit = ap_pstrdup(r->pool, (char*) xmlEncodeEntitiesReentrant(doc, (xmlChar*) titolo));
    xmlNewChild(node, NULL, (xmlChar*) "Title", (xmlChar*) tit);
  }
........

The libxml2 gives me:

 output conversion failed due to conv error
Bytes: 0xE8 0x2B 0xF2 0xE0
xmlOutputBufferFlush: encoder error


and when I try to write to a buffer with:

xmlDocDumpMemoryEnc(doc, bufptr, &size,"iso-8859-1");

I receive:

Fatal Error at (file <unknown>, line 46, column 48): The input ended before all started tags were ended. Last 
tag started was 'Abstract'

I don't know where is the problem.

How can I manage latin1?

Can you help me?


Thanks a lot

--Marco




-----------------------------------------------------

Salve, il messaggio che hai ricevuto
è stato inviato per mezzo del sistema
di web mail interfree. Se anche tu vuoi 
una casella di posta free visita il
sito http://club.interfree.it
Ti aspettiamo!

-----------------------------------------------------





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