Re: [xml] newbie question about encoding

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Mon Oct 23 2000 - 05:18:23 EDT


On Mon, Oct 23, 2000 at 08:53:44AM +0000, Ext.ZXSPRCR2A015@tls.mms.fr wrote:
>
> I try to create an XML document from scratch,
> with ISO-8859-1 character (french accents).
>
> doc = xmlNewDoc((xmlChar*)"1.0");
> doc->charset = XML_CHAR_ENCODING_UTF8;
> doc->encoding = xmlStrDup((xmlChar*)"ISO-8859-1");
>
> When I add a node, I use :
>
> node = xmlNewDocText(node, xmlEncodeEntitiesReentrant(doc,
> (xmlChar*)"Iréné"));
>
> Everything OK to create doc, but I can't find a way to
> dump document (always "output conversion failed" message).

  Well libxml expect it's internal content to be encoded in UTF8.
The string passed to xmlEncodeEntitiesReentrant should first be
converted to UTF8. You can use isolat1ToUTF8() for this (it's public
in the encoding.c module but it seems I forgot to add it to the
encoding.h module, will do).

> How to change conversion function to ISO Lantin 1 ?

  I tried to detail how and why libxml handle internationalization
issues:
   http://xmlsoft.org/encoding.html

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | libxml Gnome XML toolkit
Tel : +33 476 615 257  | 655, avenue de l'Europe | http://xmlsoft.org/
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Rpmfind search site
 http://www.w3.org/People/all#veillard%40w3.org  | http://rpmfind.net/
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 05:43:26 EDT