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

Re: EXPAT service program which comes with HTTPAPI



Excellent, thanks Scott. Got Expat working great now.

Garry

On Tue, May 12, 2009 at 5:48 PM, Scott Klement <sk@xxxxxxxxxxxxxxxx> wrote:
> Hi Garry,
>
> If CCSID 1200 isn't supported on V5R1 (I don't remember when it was
> introduced) you can use CCSID 13488 (which is UCS-2).   UTF-16 is a
> superset of UCS-2 -- and the characters that were added to UTF-16 are
> somewhat obscure, so you'll probably never run into them.
>
> So... use CCSID 1200 if available, and if not, try CCSID 13488
>
>
> Garry Taylor wrote:
>> Hi Scott,
>> I suspected this after I'd sent this mail, so I did a quick few tests
>> and indeed it is UTF16, and my problems were compounded by the fact I
>> was using standard header files, which assume UTF8, so the XML_Char
>> type was wrong, so when I did a "sizeof" on the type, it came back as
>> "1", when it blatantly was not...
>>
>> Thank you for the iconv tip, for some reason I had it in my head that
>> the UTF16 CCSID was added very recently, and would not be on V5R1, but
>> I think from IBM docs, that is available that far back after all.
>>
>> Thanks for the help, and for porting Expat in the first place, will
>> make my life much easier!
>>
>> Cheers
>>
>> Garry
>>
>> On Mon, May 11, 2009 at 7:03 PM, Scott Klement <sk@xxxxxxxxxxxxxxxx> wrote:
>>> Hi Garry,
>>>
>>> The data that's passed to your callbacks will be in UTF-16 format, not
>>> EBCDIC.  If you try to treat it as a zero-terminated string (as is
>>> standard in C) you'll have a bad time of it, since each character is two
>>> bytes long, and the first byte of most common characters is 0x00.  So
>>> you'll end up will an "empty string".
>>>
>>> To determine the size of the element names, attribute names & attribute
>>> values, you'll need to look for two consecutive bytes set to 0x00.
>>>
>>> In the character data handler, the size of the string should be passed
>>> as one of the args to your function, so you won't want to search for
>>> zeros in that case.
>>>
>>> Once you get the data, use iconv() to convert it from UTF-16 (IBM CCSID
>>> 1200) to EBCDIC...  then you'll have an ordinary string you can use for
>>> your own purposes.
>>>
>>>
>>> Garry Taylor wrote:
>>>> Hi All,
>>>> I'm attempting to use the EXPAT service program which is supplied with
>>>> HTTPAPI, and I'm linking it to my program like so:
>>>>
>>>> CRTPGM PGM(THEGMAN1/TESTEXPAT) MODULE(THEGMAN1/EXPATMAIN)
>>>> BNDSRVPGM(LIBHTTP/EXPAT)
>>>>
>>>> I got the Expat header files from the source distribution of Expat,
>>>> and compiled one of the example programs which is supplied. All of
>>>> this went without incident, until I run the PGM, when it processes the
>>>> XML without error, but on the start element handler, it does not print
>>>> out either name or any of the element attributes, although it does
>>>> print out the depth in the XML tree of each element and no parse error
>>>> is given.
>>>>
>>>> If I deliberately invalidate the XML, this is reported perfectly, so I
>>>> think the parser is working just fine, but the printing is not.
>>>>
>>>> I'm doing all this in C, and my XML file is untouched UTF8, so at what
>>>> point can this text be converted to EBCDIC to get printed, does this
>>>> sound like the problem?
>>>>
>>>> Any ideas what the problem is?
>>>>
>>>> Thanks
>>>>
>>>> Garry
>>>> -----------------------------------------------------------------------
>>>> 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
>> -----------------------------------------------------------------------
>>
>
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------