Re: [xml] Arabic ISO-8859-6 in XML ?



On Fri, Apr 19, 2002 at 10:10:01AM +0200, Genty Jean-Paul wrote:
  I have a little problem using Arabic charset ISO-8859-6 with libxml. ( 
iconv 1.7, libxml2-2.4.16 )
My purpose is to embend some Arabic text ( unfortunately not UNICODE ) in 
XML, transport my XML elsewhere, and retrieve
my Arabic text.
Here's my little test.

      xmlDocPtr pDoc;    // my XML tree
      xmlChar *strChaineXml;
      int iSize;
      xmlChar szArabic[6]; // an arabic string
[...]
      pUsersNode = xmlNewChild(pDoc->children, NULL, (const xmlChar *) "name",
              (const xmlChar *)szArabic);
[...]
  So my question is : what do I do wrong, and is there a mean to do what I 

  What you did wrong is to not read the documentation:
     http://xmlsoft.org/encoding.html

The internal representation is UTF8, adding a string to the document that
string MUST be UTF8 encoded. You must convert (using iconv for example)
your strings to UTF8 before adding it to the tree.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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