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

Re: [Ftpapi] HTTPAPI Character conversion



Scott

 

Thank you for such a quick response, your findings and suggestion were spot on and this has now corrected my issue.

May I also take this opportunity of both thanking you and congratulating you on this excellent and well documented package HTTPAPI

 

Cheers

Mark Hall

 

From: <ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx> on behalf of Scott Klement <sk@xxxxxxxxxxxxxxxx>
Reply to: FTPAPI/HTTPAPI mailing list <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Date: Friday, 5 February 2021 at 02:37
To: "ftpapi@xxxxxxxxxxxxxxxxxxxxxx" <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [Ftpapi] HTTPAPI Character conversion

 

Hi Mark,

Here's a chart that shows the values of characters in code page 819:

http://ascii-table.com/codepage.php?819

As you can see, hex 5B and 5D are the correct values for these characters.   Also, HTTPAPI is not translating them at all.  It is merely copying them to disk, as-is.  It only does translation for the received document when it reports it as a character string in your program (since RPG expects EBCDIC.)   It does not translate data off of the network when saving to a file, since certain types of files (images, videos, sounds, and many more) would be hopelessly corrupted if they were changed.

The problem is occurring when you use a program to try to view it.  This is when it is translating from code page 819 (which is what your file is marked with) to your job's CCSID.

Your job settings are unusual.  You have told it to use USA English and ccsid 37 (which is typically used in the USA), but you say your region is GB  (Great Britain) which normally uses CCSID 285 and language code ENG.  This makes me wonder if your terminal is expecting 285 when you're telling it to use 37.  That would certainly cause problems!

-- 
Scott Klement
sk@xxxxxxxxxxxxxxxx
 

On 2/4/2021 9:02 AM, Mark Hall wrote:

Hi

 

I am using the example 4 program from HTTPAPI  but have changed it to call this web address http://testcerts.online/as400/chartest.asp instead.

The webpage returns these results;

 

[ { "success":true, "errmsg":"" ,"list": [ { "CertNo":"630033267", "length":"0.00" }, "CertNo":"630033268", "length":"10.00" } ] } ]

 

However when the results are stored in the IFS output file from the modified example 4 program, the two opening [ (square) brackets are translated into ^ (Caret)  ( HEX 5B) symbol.  The closing ] (square) (HEX 5D) brackets are perfect.

 

I have found that if I get the webpage to write out HEX character A3 (ASCII 163) it does appear in the log and output file as an opening square brackets but appears on the website as a UK pound symbol.

Any ideas pleas?

 

The program runs with the following job attributes

DSPJOB (option 2)

 

Language identifier . . . . . . . . . . . . . . . :   ENU     

Country or region identifier  . . . . . . . . . . :   GB      

Coded character set identifier  . . . . . . . . . :   37      

Default coded character set identifier  . . . . . :   37      

Character identifier control  . . . . . . . . . . :   *DEVD   

 

 

Debug File;

 

************Beginning of data**************

HTTPAPI Ver 1.42 released 2020-10-12                                   

NTLM Ver 1.4.0 released 2014-12-22                                     

OS/400 Ver V7R3M0                                                      

                                                                        

New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0

http_persist_open(): entered                                           

http_long_ParseURL(): entered                                          

DNS resolver retrans: 2                                                

DNS resolver retry  : 2                                                

DNS resolver options: x'00000136'                                      

DNS default domain: BROWNTAWSE.COM                                     

DNS server found: 8.8.8.8                                               

DNS server found: 8.8.4.4                                              

DNS server found: 194.168.4.123

Nagle's algorithm (TCP_NODELAY) disabled.           

http_persist_req(POST) entered.                     

http_long_ParseURL(): entered                       

http_long_ParseURL(): entered                       

do_oper(POST): entered                              

There are 0 cookies in the cache                    

POST /as400/chartest.asp HTTP/1.1                   

Host: testcerts.online                              

User-Agent: http-api/1.43                           

Content-Type: application/x-www-form-urlencoded     

Content-Length: 30                                   

senddoc(): entered

itemno=1541001JO++++++&castno=                                    

recvresp(): entered                                                

HTTP/1.1 200 OK                                                   

Cache-Control: private                                            

Content-Type: text/html                                           

Server: Microsoft-IIS/10.0                                        

Set-Cookie: ASPSESSIONIDCQTDAQCD=MDOLPBOBNLOLECNAOFAAHKDO; path=/ 

Date: Thu, 04 Feb 2021 13:12:53 GMT                                

Content-Length: 154                                               

SetError() #13: HTTP/1.1 200 OK                                    

recvresp(): end with 200                                          

recvdoc parms: identity 154

header_load_cookies() entered                                                  

cookie_parse() entered                                                         

cookie =  ASPSESSIONIDCQTDAQCD=MDOLPBOBNLOLECNAOFAAHKDO; path=/                

cookie attr ASPSESSIONIDCQTDAQCD=MDOLPBOBNLOLECNAOFAAHKDO                      

cookie attr path=/                                                              

recvdoc(): entered                                                             

SetError() #0:                                                                 

recvdoc(): Receiving 154 bytes.                                                 

^  {  "success":true,  "errmsg":""  ,"list": ^   {   "CertNo":"630033267",   "length":"0.00"   },   "CertNo":"630033268",   "length":"10.00"   }    ]  } ] 

http_close(): entered                                                          

 ************End of Data********************                                                                                                                                                    



-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi