I assume you mean that yajl_get_string() does not translate these
characters properly. This most likely is because the flavor of EBCDIC
you're using in your job doesn't contain characters for these "curly
quotes".
Without modifying YAJLR4, I know of two possible solutions:
1) Call yajl_get_string_utf8 to get the UTF-8 representation. This
returns a pointer to the original C-style string in UTF-8 encoding...
you could then deal with the characters manually. Assuming you
eventually need them in EBCDIC, I'm not sure what you'd do, maybe
translate them to straight quotes?
2) An easier solution would be to use DATA-INTO with the YAJLiNTO
parser, and specify ccsid=ucs2, and define the RPG field also as UCS-2.
This causes all of DATA-INTO's work to be done in Unicode, and since the
RPG field is also unicode, you'd get the quotes as expected. Of course,
you'll still run into the same problem when translating to EBCDIC, but
like with #1, you could convert them. This is just much easier to code
than #1 becuase you don't have to deal with the C-style string in UTF-8
since the data will be in RPG's string format encoded in UCS-2.
If I did change YAJLR4, I'd probably create something like
YAJL_get_string_ucs2 to get the string in UCS-2 format... that would
give you the same result as #2 without needing to use DATA-INTO.
No matter how you approach it, you're going to still have to figure out
what to do when you translate to EBCDIC.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.