You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Retrieving a solution from the knowledge base (manually created ontologies) that includes a two-byte special character like the german umlaut "ä" via PrologClient.cpp causes PrologBindings.cpp to throw the following error:
JSON data must be UTF-8 encoded
Cause
In PrologEngine.cpp line 95 PL_atom_chars(atom) returns the solution of the query result encoded in UTF-16 format: e.g. ä = 0x00E4.
This solution is then parsed in PrologQuery.cpp line 89 by PrologBindings::parseJSONBindings(resp.solution) which expects resp.solution to be UTF-8 encoded: e.g. ä = 0xC3 0xA4 and thus throws the JSON Error.
Storing special characters
The missing conversion between UTF-16 and UTF-8 also concerns the storage of special characters into the knowledge base. Instead of an "ä", the corresponding UTF-8 encoded characters "ä" are stored in the ontologies.
Maybe there is a different Prolog predicate instead of PL_atom_chars() that fixes this encoding problem or it could be resolved by adding a encoding conversion function to PrologEngine::run()?
The text was updated successfully, but these errors were encountered:
Current Behavior
Retrieving special characters causes JSON error
Retrieving a solution from the knowledge base (manually created ontologies) that includes a two-byte special character like the german umlaut "ä" via
PrologClient.cpp
causesPrologBindings.cpp
to throw the following error:Cause
In
PrologEngine.cpp
line 95PL_atom_chars(atom)
returns the solution of the query result encoded in UTF-16 format: e.g. ä = 0x00E4.This solution is then parsed in
PrologQuery.cpp
line 89 byPrologBindings::parseJSONBindings(resp.solution)
which expectsresp.solution
to be UTF-8 encoded: e.g. ä = 0xC3 0xA4 and thus throws the JSON Error.Storing special characters
The missing conversion between UTF-16 and UTF-8 also concerns the storage of special characters into the knowledge base. Instead of an "ä", the corresponding UTF-8 encoded characters "ä" are stored in the ontologies.
Maybe there is a different Prolog predicate instead of
PL_atom_chars()
that fixes this encoding problem or it could be resolved by adding a encoding conversion function toPrologEngine::run()
?The text was updated successfully, but these errors were encountered: