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

Re: [Ftpapi] Problem with utf-8 data received using new http_string() procedure and YAJL.



You can set the ccsid for an variable.

 

 

//control option                                    

ctl-opt option(*nodebugio:*srcstmt)                  

        CCSID(*CHAR:37) CCSID(*UCS2:1200)           

        CCSIDCVT(*EXCP)                             

        CCSID(*EXACT)                               

        dftactgrp(*no) ;                            

                                                     

//variables                                          

dcl-s ToBeEncoded Varchar(100) Inz('') CCSID(1208); 

dcl-s name varchar(20) ccsid(*jobrun);              

dcl-s temp_name varucs2(20);                         

dcl-s stringA char(10000) ccsid(*utf8);             

dcl-pr getData varchar(10000) ccsid(*utf8);         

       

//data structures                                             

dcl-ds ds1 likerec(rec) ccsid(*exact);              

 

dcl-ds ds2 extname('MYFILE') ccsid(*exact);  

                               

               

set ccsid(*char : *JOBRUN) ;                 

                                              

restore ccsid(*char) ;                       

 

 

 

From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of la Croix, Richard
Sent: Friday, March 31, 2017 12:11 PM
To: FTPAPI/HTTPAPI mailing list <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [Ftpapi] Problem with utf-8 data received using new http_string() procedure and YAJL.

 

Hello all,

 

I am having a problem with utf-8 data received using the new http_string procedure.

 

When I use http_stmf() I can first set the ccsid for the output file to 1208 (using http_setOption('file-ccsid': '1208')), as JSON data should always be utf-8 (ccsid 1208).

I can then process the file with yajl_stmf_load_tree() and the utf-8 strings are converted correctly.

 

I would like to skip the detour via the ifs and directly process the string as received using the http_string() procedure. However when I pass the output from http_string() to yajl_buf_load_tree() the JSON fields containing utf-8 data come out wrong (e.g. ‘Randonnée’ vs. ‘Randonnée’).

 

As far as I can see, there is no equivalent to setting http_setOption('file-ccsid': '1208') for directly receiving utf-8 data into a variable.

 

Am I missing something? Any ideas?

 

Best regards,

Richard


Richard la Croix

Software Developer
IT & Telecommunication


Hapimag AG
Neuhofstrasse 8
6340 Baar 
Schweiz

Phone   +41 (41) 7 67 81 53
Fax         +41 (41) 7 67 89 10
richard.lacroix@xxxxxxxxxxx
facebook

Geschaeftssitz:
Hapimag AG
Neuhofstrasse 8
6340 Baar
Schweiz
Eingetragen: Handelsregister des Kantons Zug 
Firmennummer/UID: CHE-101.391.790
MWST.-Nr.: CHE-101.391.790 MWST
COB: Dr. Giatgen Peder Fontana
CEO: Hassan Kadbi

FinanceOfficeCH@xxxxxxxxxxx
Member of the Hapimag Group
www.hapimag.com




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