Accented characters not processed correctly

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
jonboy49
Posts: 244
Joined: Wed Jul 28, 2021 8:18 pm

Accented characters not processed correctly

Post by jonboy49 »

I'm hoping someone has experienced this before and can point me in the right direction to resolve it.

I'm sending this data to a Zoom API:
{"email":"Lopez18.02.50@partner400.com","first_name":"López","last_name" ....

I can see from the HTTP debug log that the accent is there. When I debug the HTTPAPI routines the data appears to be "intact" up until the point it goes out the door. BUT when processed by Zoom's API the accented character just becomes the unknown question mark thing like so "L�pez".

If I take the exactly same data (literally copy/paste) and run it through Postman the correct accent is retained.

So it appears that the issue is not the Zoom API per se but something is missing in the way I'm using it with HTTPAPI I guess.

Any suggestions on where to look next?
Scott Klement
Site Admin
Posts: 872
Joined: Sun Jul 04, 2021 5:12 am

Re: Accented characters not processed correctly

Post by Scott Klement »

I'm not familiar with a "Zoom API", but most APIs use UTF-8.

Have you configured HTTPAPI to convert to UTF-8?
jonboy49
Posts: 244
Joined: Wed Jul 28, 2021 8:18 pm

Re: Accented characters not processed correctly

Post by jonboy49 »

Not sure what you mean by “configured” Scott I don’t recall any specific setting.
jonboy49
Posts: 244
Joined: Wed Jul 28, 2021 8:18 pm

Re: Accented characters not processed correctly

Post by jonboy49 »

OK - I seem to have found how to do it but would like confirmation.

Adding: http_setOption ( 'network-ccsid' : '1208' );

Seems to be the magic sauce.

I have never needed to do that before. Because everything that I had done previously worked just fine, I had assumed that UTF8 was the default.

Now I know better.
Scott Klement
Site Admin
Posts: 872
Joined: Sun Jul 04, 2021 5:12 am

Re: Accented characters not processed correctly

Post by Scott Klement »

It defaults to the value you have compiled into the CONFIG_H member, which ships with 819 (ISO-8859-1).

UTF-8 would've been a better default, but I don't want to change it because it'd break backward compatability.
jonboy49
Posts: 244
Joined: Wed Jul 28, 2021 8:18 pm

Re: Accented characters not processed correctly

Post by jonboy49 »

OK thanks Scott.

I'll look at changing mine.
Post Reply