w0rp/dson

question about uppercase accentuated letters

Opened this issue · 2 comments

Hi,
I don't know if it's a bug, or if i have done something wrong.

I've try the following code :

auto objet = jsonObject();
objet["valeur"] = "é".toUpper();
writeln(objet);
auto js = toJSON(objet);
writeln(js);
auto objet2 = parseJSON(js);
writeln(objet2);

and it gives me :

["valeur":É]
{"valeur":"\u0089"}
["valeur":�]

It seems the É isn't properly converted.
There is no trouble with lowercase accentuated letters, only with uppercase accentuated letters.

w0rp commented

That was a bug. It wasn't recognising bytes out of the ASCII range for UTF-8 properly. I just modified it to just pass through every code unit greater than 127 through exactly, so that should work now. It will allow invalid UTF-8 sequences through, which is probably wrong.

I'd watch Sönke Ludwig's thread on replacing std.json, as his implementation is likely to replace std.json eventually, and it will be the one JSON implementation to rule them all. http://forum.dlang.org/thread/lt5s76$is$1@digitalmars.com

ok, thanks for the link