just a - say - technical curiosity I have, which didn't find an easy explanation.
I have a little program to retrieve machine aided translations including the use of HTTPAPI that receive an UTF8 (multilanguage, there can be 4byte characters etc. inside) string that I then DATA-INTO into a DS (with all strings all UTF8 defined explicitely field by field with CCSID(*UTF8)).
To be complete, I have also some UCS2 fields in the module with CCSID(*UTF16) explicit, to move information then in the UI or business layer ("business layer" is by convention UTF16 internally, GUI also, database also, UTF8 tends to be for net transport, external json serialization etc.).
All is working fine, but the moment I put CTL-OPT CCSID(*UCS2 : *UTF16) in the module to avoid explicit CCSID in my UCS2 vars, this statement crashes with a parse error, without it, all works
res_s is a UTF8 json string.DATA-INTO res %DATA(res_s : 'allowmissing=yes allowextra=yes +
case=any countprefix=cnt_ ' )
%PARSER('YAJLINTO');
Tracing DATA-INTO with the CTL-OPT off it says
Data length 138 bytes
Data CCSID 13488
Converting data to UTF-8
Allocating YAJL stream parser
Parsing JSON data (yajl_parse)
[...all ok....]
With the CTL-OPT on
---------------- Start ---------------
Data length 138 bytes
Data CCSID 1200
Converting data to UTF-8
Allocating YAJL stream parser
Parsing JSON data (yajl_parse)
YAJL parser status 0 after 0 bytes
YAJL parser final status: 2
YAJL error: parse error: premature EOF
ReportError, RC = 1002
- Bytes parsed: 0
Terminating due to error
It clearly changes the behaviour of the parser itself internally and not the module? Intuitively CCSID 1200 would even be "more correct" to even convert UTF8 due to whole coverage of unicode codepoints...
any insights? or any parameter to pass to the parser to force a particular work CCSID (like UTF8? being by parsing source and destination UTF8)
thanks