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

Re: expat encoding



I forgot to mention that I assume that eXpat natively supports the following encodings (see: http://www.jclark.com/xml/expatfaq.html):

    utf-8
    utf-16
    iso-8859-1
    us-ascii

So for example if you have your XML data encoded in 1252, you first need to translate it to one of these encodings. HTTPAPI either can use the encoding of the stream file and use the OS to convert the data to 1208. Or it can translate the data from a given CCSID to 1208 on its own before passing the data to eXpat.

Thomas.

Am 05.12.2012 22:37, schrieb Thomas Raddatz:
Gerald,

Please change the CCSID of your XML file from 819 to 1252 to match the
encoding of the XML data.

Then call http_parse_xml_stmf() with HTTP_STMF_CALC. This way the file is
opened in text mode, using the OS to translate the data from 1252 to 1208.
Then the 1208 encoded data is passed to the parser.

Snippet from http_parse_xml_stmf():

   when peCCSID = HTTP_STMF_CALC;
      wwEncoding = XML_ENC_UTF8;
      wwFD = open( %trimr(peFile)
                 : O_RDONLY + O_TEXTDATA
                 : 0
                 : 1208 );


   wkParser = InitParser(wkElemRoot: wwEncoding);


You may also try to specify 1252 for the CCSID when calling
http_xml_parse_stmf(). In this case the XML file is opened in binary mode
and the input data is passed to xml_xlate() to translate it from 1252 to
1208 before it goes to the parser.

I assume that the first option is faster because I believe that the
operating system translates the data more efficiently when it reads the
data from the file. Whereas xml_xlate() uses iconvdyn() which may need to
reallocate memory when translating the data to 1208.

Thomas.

Am 05.12.2012 21:42, schrieb Gerald Magnuson:
    I am trying to extract a xml derived from dbVisualizer


    <?xml version="1.0" encoding="Cp1252"?>


    Actual CCSID of file is 819.


    I am trying to use the USERDATA example, but am getting

    "unknown encoding" error.


    Do I need to do something to my XML file in the ifs, or do I need

    To add some setting in my program to say what my CCSID is?



-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------