So I am experimenting with RPGLE CGI programs. Specifically decoding search parameters. And I have noticed an oddity with handling the £ character.
When this is entered in a HTML form or some such, the browser will escape this single character in the search parms as two characters: %C2%A3
When I read the QUERY_STRING environment variable in my CGI program, I can see this has already been EBCDIC translated to %62%B1
When I then use QzhbCgiParse() to retrieve and decode this specific value from the query string, %62%B1 is unescaped to £ instead of just to £
So I'm getting an extra, unwanted  character, as an artefact of (I assume) the escape/unescape process and/or the character set conversion.
I assume the browser is escape encoding £ as two characters because £ does not technically exist in standard UTF-8? But why is the iSeries not able to decode it correctly? Is there a way I can make it decode correctly?
This is a UK iSeries, but CCSID's throughout the system are 037 US instead of 285 UK, and that's not within my power to change, and neither are the HTTP server settings (which I assume are why the data is already translated to EBCDIC).
When this is entered in a HTML form or some such, the browser will escape this single character in the search parms as two characters: %C2%A3
When I read the QUERY_STRING environment variable in my CGI program, I can see this has already been EBCDIC translated to %62%B1
When I then use QzhbCgiParse() to retrieve and decode this specific value from the query string, %62%B1 is unescaped to £ instead of just to £
So I'm getting an extra, unwanted  character, as an artefact of (I assume) the escape/unescape process and/or the character set conversion.
I assume the browser is escape encoding £ as two characters because £ does not technically exist in standard UTF-8? But why is the iSeries not able to decode it correctly? Is there a way I can make it decode correctly?
This is a UK iSeries, but CCSID's throughout the system are 037 US instead of 285 UK, and that's not within my power to change, and neither are the HTTP server settings (which I assume are why the data is already translated to EBCDIC).
Comment