I'm trying to create a Json formated String with accents. Simplifying a bit the process is something like:
var dataJson (dataObj);
String dataString = JSON::toString(dataJson);
Logger::writeToLog(dataString);
My expected output in the attributes with accents is:
"value": "Hello world! é",
but I get:
"value": "Hello world! \u00e1",
I really dont't know where to look to solve this issue. The value is printed fine before calling JSON::toString and everywhere else in the aplication. Can give me some clues?
Ok I understand. Thanks for the info. The problem is the server I'm sending the info to is not propertly parsing that escaped characters, and I can not modify the parsing code. So I finally I will have to replace all the special characters after calling JSON::toString(dataJson); Something like
ok, but you should at least un-escape it properly rather than hacking it for that specific character. Have a look at JSONParser::parseString for inspiration.
As I have control over the client I ended URI encoding Strings before creating the JSON and decoding them back in the client. I found this more clean to understand and works fine with the server.