Issue with Character Encoding in HTTPAPI on IBM iSeries (V7R2)
Posted: Fri Mar 28, 2025 6:30 pm
Hi Scott,
We are experiencing an issue with character encoding when using Scott Klement's HTTPAPI library on an IBM iSeries system running V7R2. We have implemented HTTPAPI to make RESTful API calls to external endpoints, and while the same program runs correctly on an IBM iSeries in Spain, we are encountering unexpected character encoding issues when running it on a different IBM iSeries system in Germany.
Issue Description:
When sending a JSON payload from the system in Germany, an unexpected character "Â" (UTF-8: C3 82) appears before the opening square bracket ([).
Example JSON output from Spain (correct):
[{"FiscalId": "37281892L","FiscalName": "JAIME BIGAS"}]
Example JSON output from Germany (incorrect):
Â[{"FiscalId": "37281892L","FiscalName": "JAIME BIGAS"}]
This suggests that the conversion from EBCDIC to UTF-8 is not being handled correctly for certain characters, possibly the opening square bracket [ (EBCDIC 37: AD).
Steps Taken to Resolve the Issue:
1. Checked HTTPAPI Encoding Options:
o We set the following options:
o http_setOption('local-ccsid': '37'); // EBCDIC 37
o http_setOption('network-ccsid': '1208'); // UTF-8
o http_setOption('send-encoding', 'utf-8');
These settings did not resolve the issue.
2. Changed Job CCSID:
o We tried changing the CCSID of the job using CHGJOB CCSID(273), and later CHGJOB CCSID(37), but the issue persisted.
3. Verified Compilation CCSID:
o We confirmed that the program is compiled with CCSID 37.
4. Analyzed Hexadecimal Output:
o We compared the hex values of the output from Spain and Germany.
o In Germany, the unexpected character  (C3 82) appears before the first bracket ([).
Request for Support:
• Could this issue be related to a different system configuration between the two IBM iSeries environments?
• Is there an additional setting in HTTPAPI or system-level CCSID configuration that we should check?
• Could the default encoding of the job or PASE environment be interfering with HTTPAPI's encoding conversion?
Any guidance on resolving this encoding issue would be greatly appreciated.
Many thanks for your help
Jaume Bigas
GESISA
We are experiencing an issue with character encoding when using Scott Klement's HTTPAPI library on an IBM iSeries system running V7R2. We have implemented HTTPAPI to make RESTful API calls to external endpoints, and while the same program runs correctly on an IBM iSeries in Spain, we are encountering unexpected character encoding issues when running it on a different IBM iSeries system in Germany.
Issue Description:
When sending a JSON payload from the system in Germany, an unexpected character "Â" (UTF-8: C3 82) appears before the opening square bracket ([).
Example JSON output from Spain (correct):
[{"FiscalId": "37281892L","FiscalName": "JAIME BIGAS"}]
Example JSON output from Germany (incorrect):
Â[{"FiscalId": "37281892L","FiscalName": "JAIME BIGAS"}]
This suggests that the conversion from EBCDIC to UTF-8 is not being handled correctly for certain characters, possibly the opening square bracket [ (EBCDIC 37: AD).
Steps Taken to Resolve the Issue:
1. Checked HTTPAPI Encoding Options:
o We set the following options:
o http_setOption('local-ccsid': '37'); // EBCDIC 37
o http_setOption('network-ccsid': '1208'); // UTF-8
o http_setOption('send-encoding', 'utf-8');
These settings did not resolve the issue.
2. Changed Job CCSID:
o We tried changing the CCSID of the job using CHGJOB CCSID(273), and later CHGJOB CCSID(37), but the issue persisted.
3. Verified Compilation CCSID:
o We confirmed that the program is compiled with CCSID 37.
4. Analyzed Hexadecimal Output:
o We compared the hex values of the output from Spain and Germany.
o In Germany, the unexpected character  (C3 82) appears before the first bracket ([).
Request for Support:
• Could this issue be related to a different system configuration between the two IBM iSeries environments?
• Is there an additional setting in HTTPAPI or system-level CCSID configuration that we should check?
• Could the default encoding of the job or PASE environment be interfering with HTTPAPI's encoding conversion?
Any guidance on resolving this encoding issue would be greatly appreciated.
Many thanks for your help
Jaume Bigas
GESISA