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



I have this problem too with iso-8859-2
Pavel Stehule
On Fri, 19 Apr 2002, Genty Jean-Paul wrote:


  Hi

  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
      
      szArabic[0] = 0xD6; // I fill it with the letter Da, which code is 0xD6 ( 
214 )
      szArabic[1] = 0xD6; // I usually use a Windows 98 arabic to build a file 
but it's simpler for the test using directly a buffer
      szArabic[2] = 0xD6; // you can check ISO-8859-6 at 
http://www.langbox.com/codeset/iso8859-6.html
      szArabic[3] = 0x00;
      
      LIBXML_TEST_VERSION;
      xmlKeepBlanksDefault(0);
      pDoc = xmlNewDoc((const xmlChar *)"1.0");
      pDoc->children = xmlNewDocNode(pDoc, NULL, (const xmlChar *) "test",
              NULL);
      xmlSetProp(pDoc->children,(const xmlChar *)"object",(const xmlChar *)"users");
      
      pUsersNode = xmlNewChild(pDoc->children, NULL, (const xmlChar *) "name",
              (const xmlChar *)szArabic);
      
      /*********  Here my XML tree is build. after that I try to dump it *********/

First try:
      xmlDocDumpMemoryEnc(pDoc, &strChaineXml, &iSize, "ISO-8859-6" );
      I obtain this message:

output conversion failed due to conv error
Bytes: 0xD6 0xD6 0xD6 0x3C
xmlOutputBufferFlush: encoder error

Seconf try:
      xmlDocDumpMemoryEnc(pDoc, &strChaineXml, &iSize, "UTF-8" );
      No error so I continue, trying to rebuild my tree
      
      pDoc = xmlParseMemory((const char *)strChaineXml, iSize);
      I obtain the message

Entity: line 2: error: Input is not proper UTF-8, indicate encoding !
<test object="users"><name>+++</name></test>
      
      Wich is rigth, after all ...

  So my question is : what do I do wrong, and is there a mean to do what I 
wish to do ( see the message's top ) ?

  Cheers and  Thanks  !!

   Jean-Paul

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml





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