SetError() Ñ73: CCSID conversion failed

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
jpgvithas
Posts: 14
Joined: Mon Jul 24, 2023 7:01 am

Re: SetError() Ñ73: CCSID conversion failed

Post by jpgvithas »

Thank you very much for your help.
I have tested several medications that caused this problem, and it already works. I receive and process the response.
These programs that use your API are inherited and they all have the same statement:

Code: Select all

HTTP_SetCCSIDs(1208 : 0); 
In addition, I have eliminated, also for testing, that line of code, and it also works, so I am not clear if it should be included or not, and in what cases.
I think I understand that this sentence is for the treatment of the character "Ñ", but I have not tried it as I have not found a medicine with a name that contains that character.
Now we have to put it into production and see results.
But hey, now I see the light. Thanks again.
Scott Klement
Site Admin
Posts: 658
Joined: Sun Jul 04, 2021 5:12 am

Re: SetError() Ñ73: CCSID conversion failed

Post by Scott Klement »

jpgvithas wrote: Fri Sep 08, 2023 11:41 am Thank you very much for your help.
I have tested several medications that caused this problem, and it already works. I receive and process the response.
"medications" isn't the right word... I think you mean you've tested several situations where you had this problem, and this solved it?
jpgvithas wrote: Fri Sep 08, 2023 11:41 am These programs that use your API are inherited and they all have the same statement:

Code: Select all

HTTP_SetCCSIDs(1208 : 0); 
In addition, I have eliminated, also for testing, that line of code, and it also works, so I am not clear if it should be included or not, and in what cases.
This line of code indicates how the data that is received should be converted. It lists the Network and Local CCSIDs, respectively.

1208 = UTF-8. 0 = the job ccsid. So this says to convert the received data from UTF-8 to the job CCSID. As I told you at the start of the thread, the problem here is that your data wasn't valid UTF-8, and that's what caused the problem.

819 = ISO-8859-1 -- an particular code page of ASCII that became one of the iSO standards for Latin-1 based languages. There are many different character sets that are similar (not not quite the same) that fall into the ASCII family.

Ultimately, since these convert from Unicode/ASCII to EBCDIC, you need to know exactly what type of data you expect to receive. If the data is UTF-8 (the most common variant of Unicode) then you should specify 1208. If you expect the data to be ISO-8859-1, then you would specify 819. If you look at the CONFIG_H member that came with HTTPAPI, you can set the default value in there -- I have it set to 819 (ISO-8859-1) if you don't specify anything. But you can change it if you want.

Whatever values you set with HTTP_setCCSIDs will take precedence over what is in CONFIG_H.

You just need to tell HTTPAPI how you want it translated. In this case since the data is ISO-8859-1, you want to translate from 819 to the job's ccsid (0 is a special value for the job's ccsid). But most web documents are utf-8, so you'd say 1208 in those cases.
I think I understand that this sentence is for the treatment of the character "Ñ", but I have not tried it as I have not found a medicine with a name that contains that character.
Now we have to put it into production and see results.
But hey, now I see the light. Thanks again.
I don't understand what you mean. It specifies the entire character set... Ñ is only one character, potentially, in that set.

Or, are you referring to the Ñ in the log file? This is because you didn't convert the source for HTTPAPI to your system's character set when you compiled the program... but it doesn't really matter, it's just in the log file, doesn't affect anything that your users/customers will see.
jpgvithas
Posts: 14
Joined: Mon Jul 24, 2023 7:01 am

Re: SetError() Ñ73: CCSID conversion failed

Post by jpgvithas »

Yeah. Sorry. I wanted to say that I have tried several situations that didn't work, and now it works.
Regarding the Ñ character, I meant that I have not been able to test a situation in which I receive that character in the TAG NAME.
Thanks.
Post Reply