Issue with EBCIDIC to ASCII conversion

Discussions relating to the ScottKlement.com port of the open source YAJL JSON Reader/Generator. This includes the YAJL tool as well as the YAJLR4, YAJLGEN, YAJLINTO and YAJLDTAGEN add-ons from ScottKlement.com. http://www.scottklement.com/yajl/
Post Reply
jarhead0311
Posts: 8
Joined: Wed Dec 21, 2022 4:32 pm

Issue with EBCIDIC to ASCII conversion

Post by jarhead0311 »

I have a program written to return a JSON, but in Postman it appears as garbage. I'm assuming I'm missing something in the httpd.conf file. I looked at the httpd.conf file and it had a 'CgiConvMode %%MIXED/MIXED%%' but nothing for the DefaultFsCCSID and DefaultNetCCSID.

When I look at the apachedft job I see these attributes:

CODED CHARACTER SET IDENTIFIER . . . . . . . . . : 65535
DEFAULT CODED CHARACTER SET IDENTIFIER . . . . . : 37

I've searched and found this thread where Scott mentioned having an issue converting to EBCDIC to ASCII if the header has "application/" in the type, which mine does, being a JSON file. I've tried adding ccsid(*utf8) to the data variable and sending that in the QtmhWrStout command, but I'm still getting garbage.
Personally, the setup I use is like this:

DefaultFsCCSID 37
DefaultNetCCSID 1208
CgiConvMode %%MIXED/MIXED%%

This tells Apache that my local system is CCSID 37 for EBCDIC (you might want 278 for Sweden, I don't remember) and that the network should be CCSID 1208 (UTF-8). This will cause Apache to translate the data from UTF-8 to EBCDIC when receiving, or from EBCDIC to UTF-8 when sending.

If you leave off the DefaultNetCCSID, it will use CCSID 819, I believe -- and that's not Unicode, it's ASCII.

The other thing I've noticed is that if you use 'text/xml' it will translate it, but 'application/xml' will not. It seems to differentiate between text documents vs. non-text -- and since XML is text, but has 'application' it causes problems. Same for 'application/json'. Therefore, you may need to read into a CCSID(*UTF8) field in your RPG program, and convert it yourself. Depending on the circumstances.
I tried adding the the DefaultFsCCSID and DefaultNetCCSID as you mentioned above as well with no improvement. Any suggestions? Thanks in advance!
Scott Klement
Site Admin
Posts: 636
Joined: Sun Jul 04, 2021 5:12 am

Re: Issue with EBCIDIC to ASCII conversion

Post by Scott Klement »

As it says in the message you quoted, the Apache server doesn't typically perform conversion on application/json (or any non-text media types).
jarhead0311
Posts: 8
Joined: Wed Dec 21, 2022 4:32 pm

Re: Issue with EBCIDIC to ASCII conversion

Post by jarhead0311 »

I figured that out. When I changed it to text/json it worked. Thanks, Scott.
Post Reply