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

Re: HTTPAPI and CCSID.....



Hello Scott.

Thank you for your answer. I am a little (no very) embarrased, and I´m very
sorry for taking your time. I have now found out, what my problem was.

Your line about translation to UTF-16 was the clue...
I was using too old versions of Expat and Httpapi....

So in the EndElement of HTTPXMLR4:

/free
  if (%len(element.value) > 0);
      http_xlatep( %len(element.value)
                 : %addr(element.value) + 2
                 : TO_EBCDIC );
/end-free

element.value holds UTF-8 data, so my 'ø' takes up the space for two
letters.

In the underlaying procedures called from http_xlatep (CCSIDxlate, that
calls iconv)

C     eval      Size = peSize
C     eval      OutSize = peSize

C     callp     iconv( ToEBCDIC
C                       : peData
C                       : Size
C                       : peData
C                       : OutSize )

Size and Outsize is the same. This leaves to me, what peData was pointing
at in advance - as the last sign... because the length was now one sign
longer, than it should be.

Upgrading Expat and Httpapi solves the problem.

Again.. I´m so sorry, but thanks a lot! (from a newb)


Regards

Søren Tagmose
Multi-Support R&D A/S
--------------------------------------------------------------------
Phone +45 96 600 619, Fax +45 96 600 601
E-mail: tagmose@xxxxxxxxxxxxxxxxx
http://www.multi-support.com


                                                                           
             Scott Klement                                                 
             <sk@scottklement.                                             
             com>                                                       To 
             Sent by:                  HTTPAPI and FTPAPI Projects         
             ftpapi-bounces@li         <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>     
             sts.scottklement.                                          cc 
             com                                                           
                                                                   Subject 
                                       Re: HTTPAPI and CCSID.....          
             05-06-2007 20:09                                              
                                                                           
                                                                           
             Please respond to                                             
                HTTPAPI and                                                
              FTPAPI Projects                                              
             <ftpapi@xxxxxxxxx                                             
              ttklement.com>                                               
                                                                           
                                                                           




Hello Søren,

I tried parsing your name, and I also tried parsing Søndersø, and both
of them worked successfully for me.

Just FYI:  HTTP_setCCSIDs() is not related to the XML parsing.  The
HTTP_setCCSIDs() routine controls how data is translated when it is sent
from your RPG program to a web server.

The data that comes back from the web server is translated to UTF-16 by
the Expat parser, not by HTTPAPI.  It is translated according to the
<?xml encoding="xxxx"?> attribute of the XML file, or it's assumed to be
in UTF-8 if there's no encoding listed.

HTTPAPI uses ILE RPG's built-in support for UCS2 Unicode to convert the
UTF-16 data into EBCDIC.

You've done a good job of telling me what your complaint is -- why
you're having trouble.  But you haven't really provided much in the way
of technical details.   What does the actual data coming from the web
server look like?  How is it encoded?  Is there an XML encoding tag (as
explained above) listed, and what does it say?   What are the hex values
of the special danish characters as they are coming across the wire?

So I have to do a lot of guessing and experimenting, to try to help you,
which is very time consuming.  But, the examples that I tried did print
the special characters correctly, no problems there...




tagmose@xxxxxxxxxxxxxxxxx wrote:
> Hi again (again)
>
> As I told:
>
> An element from the XML could be:
> <testElem>Søren Tagmose</testElem>
>
> The text is my name, and the second letter is 'ø' from the danish
> alphabet...
>
> Calling HTTP_SetCCSIDs(1208 : 277) and call http_url_post_xml
> leads me to my EndProc callback procedure.
>
> /free
>       if name = 'testElem';
>        tempVal = value
>       endif;
> /end-free
>
> Now tempVal = 'Søren TagmoseÀ'
>
>
> But I also found out, that if the element includes more than one "danish"
> letters:
> <testElem>Søndersø</testElem> (a little town in Denmark with not only one
> 'ø', but two 'ø' s)
>
> /free
>       if name = 'testElem';
>        tempVal = value
>       endif;
> /end-free
>
> Now tempVal = 'SøndersøC½'
>
> So it seems that for every "danish" letter an extra sign is added to the
> end of the element?
>
> What can I do?
>
> Regards
>
> Søren Tagmose
> Multi-Support R&D A/S
> --------------------------------------------------------------------
> Phone +45 96 600 619, Fax +45 96 600 601
> E-mail: tagmose@xxxxxxxxxxxxxxxxx
> http://www.multi-support.com
>
>
>

>              Scott Klement

>              <sk@scottklement.

>              com>
To
>              Sent by:                  HTTPAPI and FTPAPI Projects

>              ftpapi-bounces@li         <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>

>              sts.scottklement.
cc
>              com

>
Subject
>                                        Re: HTTPAPI and CCSID.....

>              27-05-2007 21:25

>

>

>              Please respond to

>                 HTTPAPI and

>               FTPAPI Projects

>              <ftpapi@xxxxxxxxx

>               ttklement.com>

>

>

>
>
>
>
> You can use HTTP_setCCSIDs(1208:277) or you can use
> HTTP_setCCSIDs(1208:0), they should do the same thing, since 0=Job
> CCSID, and you say you job CCSID is 277.
>
> Can you tell us more about the problem?  You say you're receiving a
> mysterious sign added...   but you didn't say more than that.  Can you
> please tell us more?
>
> Can you send a sample XML that illustrates the problem?
>
>
>
> tagmose@xxxxxxxxxxxxxxxxx wrote:
>> Hello.
>>
>> I am working on a project, where I should call a webservise and then
> parse
>> the response and of course save the incomming data in a database. (DB2)
>>
>> I am very happy to tell, that the HTTPAPI is relatively easy to use, and
>> works perfect (perhaps??)
>>
>> But at least I have a problem...
>>
>> My response is in UTF-8, and my standard job-ccsid is 277 (Denmark), so
i
>> figured, that I have to override the standard CCS-id´s in HTTPAPI?
>>
>> So here is what I do:
>>
>> I call HTTP_SetCCSIDs(1208 : 277)
>> and then I call http_url_post_xml
>>
>>
>> I recieve a response, and it is parsed ok, but the text, that contains
>> "DK-specific-characters" is now ok except for a mysterious sign added as
>> last character....
>> So right now, I can coose a text with miss-translated "DK-specific"
>> characters - or I can have a good translation - but with a mysterical
> sign
>> added at the end of the line.
>>
>> What am I doing wrong?
>>
>> Regards
>>
>> Søren Tagmose
>> Multi-Support R&D A/S
>> --------------------------------------------------------------------
>> Phone +45 96 600 619, Fax +45 96 600 601
>> E-mail: tagmose@xxxxxxxxxxxxxxxxx
>> http://www.multi-support.com
>>
>> -----------------------------------------------------------------------
>> 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
-----------------------------------------------------------------------