QDCXLATE Not converting the brackets in JSON String

Discussions relating to writing software in ILE RPG (RPG IV). This includes both fixed and free format RPG.
Post Reply
bbunney
Posts: 45
Joined: Wed Jul 06, 2022 7:52 pm

QDCXLATE Not converting the brackets in JSON String

Post by bbunney »

We use QDCXLATE to convert ASCII to EBCDIC for JSON string that come through a web service. It doesn't convert the JSON brackets [ ] correctly. We tried both QEBCDIC and QTCPEBC and it did not work. Got like a '?' instead. We are trying now to use CCSID(1208) on the JSON string to see if that works. I don't want to mess around with iconv() unless I have to. Instead of using one of the IBM Supplied conversion tables, how would we create a conversion table of our own where we could control the translations in it? I checked the IBM info and says we can do it and I was able to create a new conversion table based on QEBCDIC in QSYS in my library but I don't know how to update it. Thanks.

Code: Select all

CRTTBL TBL(BBUNNEY/JEBCDIC) BASETBL(QEBCDIC) SRCFILE(*PROMPT) TEXT('JSON ASCII to EBCDIC Translation Table') 
Table JEBCDIC in library BBUNNEY created.                               
Scott Klement
Site Admin
Posts: 652
Joined: Sun Jul 04, 2021 5:12 am

Re: QDCXLATE Not converting the brackets in JSON String

Post by Scott Klement »

You shouldn't be converting ASCII to EBCDIC.

Most computers no longer use ASCII. It is an outdated standard... they are using Unicode, not ASCII.

But even if you were... "ASCII" isn't specific. It's a whole family of different character encodings! There are many, many, many different things called "ASCII", and that's why QTCPEBC and QEBCDIC aren't working for you. They are translating from a different ASCII than the one you're using.

Likewise, there are many different EBCDICs... same spiel...

PLEASE PLEASE PLEASE use iconv().
bbunney
Posts: 45
Joined: Wed Jul 06, 2022 7:52 pm

Re: QDCXLATE Not converting the brackets in JSON String

Post by bbunney »

Okay I can use iconv(). I have the example code for it. Thanks Scott.
Post Reply