HaxeFoundation / HaxeFoundation/haxe

haxe.Json does not encode Unicode properly

Open
#12,221 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.