HaxeFoundation / HaxeFoundation/haxe
haxe.Json does not encode Unicode properly
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
Any string containing emoji for example is corrupted on CPP. Using this fixes it:
```
function quote(s:UnicodeString) {
addChar('"'.code);
for (c in s) {
switch (c) {
case '"'.code:
add('\\"');
case '\\'.code:
add('\\\\');
case '\n'.code:
add('\\n');
case '\r'.code:
add('\\r');
case '\t'.code:
add('\\t');
case 8:
add('\\b');
case 12:
add('\\f');
default:
addChar(c);
}
}
addChar('"'.code);
}
```
Contributor guide
Assessment
This issue has not been assessed yet.