Tuesday, July 30, 2019

JSON, the Euro symbol and a WE8MSWIN1252 character set database

Always check out the original article at http://www.oraclequirks.com for latest comments, fixes and updates.

Trying to parse a JSON_OBJECT_T string containing the € (euro) character on a WE8MSWIN1252
12.2.0.1.0 database returns the following error:
 
declare
 j json_object_t;
begin
 j := json_object_t.parse('{"currency":"€"}');
end;
/
 
ORA-40441: JSON syntax error
ORA-06512: at "SYS.JDOM_T", line 4
ORA-06512: at "SYS.JSON_OBJECT_T", line 86
ORA-06512: at line 10
40441. 00000 -  "JSON syntax error"
*Cause:    The provided JavaScript Object Notation (JSON) data had invalid
           syntax and could not be parsed.
*Action:   Provide JSON data with the correct syntax.

The only workaround I found consists in converting € into € before parsing and back after retrieving the JSON value.
The same problem occurs with the Yen symbol ¥ and the Sterling Pound symbol £.

I also made a test on an AL32UTF8 database where everything works smoothly without having to handle these symbols in a special way.


The pleasures of working with an 8-bit database.

No comments:

yes you can!

Two great ways to help us out with a minimal effort. Click on the Google Plus +1 button above or...
We appreciate your support!

latest articles