I'm having problems sending utf-8 strings to a rest server using http_req.
I'm not sure if I'm doing it well:
I have a pf with dds like this:
Code: Select all
UNIQUE
R RTEXT1
LANG 1A
NUMBER 5S 0
TEXT 50G CCSID(1200 *NOCONVERT)
K LANG
K NUMBER
TEXT. contains data in different languages (spanish, engligh, russian, greek, and sometimes data in mixed languages...).
I have been coding something like this:
Code: Select all
chain ('G':1) rtext1;
if not %found;
clear *all rtext1;
endif;
profile.name = x_text;
data-gen profile %data(jsonVAR) %gen('YAJL/YAJLDTAGEN');
jsonVAR is defined as a varchar(255) ccsid(*utf8). data-gen and YAJL is doing well. I have used HTTPPUTCLOB with that string, and is working fine. But when I try it with HTTPAPI, something is not working well:
Code: Select all
http_setOption('local-ccsid': '0');
http_setOption('network-ccsid': '1208');
http_setOption('content-type':'application/json');
monitor;
http_req('PUT':
profileURL:
*omit:
response:
*omit:
jsonVAR:
'application/json; charset=utf-8');
on-error;
dsply 'Error';
endmon;
Thanks
