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

RE: Sending Big5 through httpapi



Hi Scott,

Me again.
I try the following codes
C                   callp     HTTP_SetCCSIDs(950:937)    
C                   Eval      W1SndMsg = X'4F5C'       
C                   Eval      Enc = HTTP_url_encoder_new()        
C                   callp     http_url_encoder_addvar(enc:         
C                             'msg':%addr(W1SndMsg):               
C                              %len(%trimr(W1SndMsg)))             
C                   callp     http_url_encoder_getptr(enc: o_data: o_size)   
C                   Eval      URL = 'http://somewhere.com'      
C                                  + '/app/servlet/GenSendSM?'                  
C                                  + 'acc=my_acc'                              
C                                  + '&pwd=my_pwd'                            
C                                  + '&msisdn=phone'                                 
C                                  + '&suffix=0'                                
C                                  + '&req_sms_status=y'                        
C                                  + '&'                                        
C                                  + http_url_encoder_getstr(enc)               

The I get from debug for URL is
http://somewhere.com/app/servlet/GenSendSM?acc=my_acc&pwd=my_acc&msisdn=phone&suffix=0&req_sms_status=y&msg=%7C*                          

1. I don't know why I need to use the value 'msg' in calling http_url_encoder_addvar() instead of '&msg' and add back '&' in the URL string, but it works. Otherwise, the '&' will become '%26', like
http://somewhere.com/app/servlet/GenSendSM?acc=my_acc&pwd=my_acc&msisdn=phone&suffix=0&req_sms_status=y%26msg=%7C*                          

2. The value x'4F5C' become '7C*' seems half of '5C' byte is chopped as x'4F' is '7C' under CCSID 819

3. When I using STRCMNTRC to take a look of the bytes in the LAN card, it is 'translated' to UTF-8.

Could you let met know that your HTTPAPI is supporting big5 (double Chinese character) or not ?

Thanks 


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of CISD Hang Lam Chan
Sent: Tuesday, September 14, 2010 12:46 PM
To: HTTPAPI and FTPAPI Projects
Subject: RE: Sending Big5 through httpapi

Dear Scott,

Thanks for your help.
Before I go to next steps as you suggested, I just want to make it clear what I want and where is the problem.

[Simply Description]
PC client (CCSID = 950) running Clinet Access and user input "我" (=x'A7DA') into AS400 running CCSID = 937, and AS400 store the value x'4F5C' in Physical File

[Objective]
A program is needed to send the x'4F5C' as stored in Physical File of AS400 to PC server running CCSID = 950 throuhg HTTP protocol as value x'A7DA' received in PC Sever side

[Problem]
When this program sent x'4F5C' to PC server, the server received as x'7C2A'
We find that this mapping follow mapping ISO-8859-1

The Answering from IBM is for CCSID in this case:
If I input an character "我" from Client Access with host-code page 937 to a physical file with CCSID 937, provided the Windows locale is Traditional Chinese (you may check by typing command "chcp" to get 950), you will yield 4F5C where you stored in iSeries. It is a correct. 
And note 4F5C is EBCIDIC hex value. For CCSID 937, there is no character for EBCIDIC hex value for B5FE by default except you tailor-made one for it. Please see the screenshots that I captured from ICU site describing IBM-937. (http://demo.icu-project.org/icu-bin/convexp)

Could you suggest the values used in http_setCCSIDs(remote:local)?
Ie. http_setCCSIDs(950:937)? 

Regards

-----------------------------------------------------
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Tuesday, September 14, 2010 12:20 AM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Sending Big5 through httpapi

As I said in the previous message, you have to be running the current 
*beta* version for HTTP_setCCSIDs() to work with the URL encoder.
You can retrieve the current beta here:
http://www.scottklement.com/httpapi/beta

You need to call the URL encoding routines to fill in the data.  To call 
them (remember, you need the *beta* for setCCSIDs to work) you should do 
this:

  a) Call http_setCCSIDs()
  b) Call HTTP_url_encoder_new() or webform_open()
  c) Call HTTP_url_encoder_addvar, http_url_encoder_addvar_s,
          webform_setPtr, or webform_setvar for each variable
          you wish to set in the URL
  d) Call HTTP_url_encoder_getstr() or webform_getdta() to
          retrieve the encoded data so you can add it to
          your URI
  e) Call http_url_encoder_free() or webform_close() to
          clean up the memory used by the encoder.



On 9/13/2010 3:58 AM, CISD Hang Lam Chan wrote:
> Hi,
>
> Using&msg=%a7%da' is fine, however, ss the user will input message content, the data will be changed and I cannot hard-coded as&msg=%a7%da';
>
> I did try to use http_setCCSIDs() to set the CCSID, but it doesn't work.
> And, as you said I am not calling the URL encoding routines, could you let me know which routine should I call so that I can use the http_setCCSIDs() correctly?
>
> Regards
>
> -----Original Message-----
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
> Sent: Saturday, September 11, 2010 1:52 AM
> To: HTTPAPI and FTPAPI Projects
> Subject: Re: Sending Big5 through httpapi
>
> Hello,
>
>>      I am using version 1.23 and trying to send out data by RPG using
>>      HTTPAPI from AS400 to a PC with CCSID 950
>
> HTTPAPI does not attempt to URL-encode your URI automatically.  It
> assumes that you are passing a valid URL to it, that's already been
> encoded accordingly.
>
> The HTTP standard does not allow characters that are not part of
> ISO-8859-1 (CCSID 819) in a URI.  The standards state that the HTTP
> protocol will always use ISO-8859-1.
>
> If you use the current BETA version of HTTPAPI, and you call the URL
> encoding routines (which you are not currently doing) it'll allow you to
> set an alternative CCSID via http_setCCSIDs() to use UTF-8 data, and
> then it'll encode it for you to make it a valid URL.  But since you are
> not even attempting to call those routines now, HTTPAPI is definitely
> going to mistranslate your URL.
>
> If your data never changes, you could do this:
>
>     Eval      URL = 'http://somewhere.com'
>                    + '/app/servlet/GenSendSM?'
>                    + 'acc=my_acc'
>                    + '&pwd=my_pwd'
>                    + '&msisdn='
>                    + '&msg=%a7%da';
>
> This is (presumably) what the URL encoder would arrive at if you updated
> and used the URL encoder...
>
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------