ID:2517569
 
Resolved
json_encode() didn't handle UTF-8 characters correctly.
BYOND Version:513.1490
Operating System:Windows 10 Pro 64-bit
Web Browser:Firefox 68.0
Applies to:Dream Daemon
Status: Resolved (513.1491)

This issue has been resolved.
Descriptive Problem Summary:
Unicode/UTF-8 characters put into json_encode will not be properly escaped.
If the same characters are piped into world.log, they'll display (mostly) correctly in Dream Daemon.

Numbered Steps to Reproduce Problem:
1. Put unicode into json_encode
2. See output
3. Compare to, say, CyberChef's Unicode Escaper: https://gchq.github.io/CyberChef/

Code Snippet (if applicable) to Reproduce Problem:
(it's on pastebin because the forum auto-escapes the unicode) https://pastebin.com/6TRzZdea

Expected Results:
["\u0bf5\u06e9\u010d\u0161\u011b\u00ed\u00fd\u010c"]
Actual Results:
["\u00e0\u00af\u00b5\u00db\u00a9\u00c4\u008d\u00c5\u00a1\u00c4\ u203a\u00c3\u00ad\u00c3\u00bd\u00c4\u0152"]

Does the problem occur:
Every time? Or how often? Every time.
In other games? It's game-independent

When does the problem NOT occur? If I just put normal ASCII into json_encode/decode

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? It didn't occur in previous versions, because previous versions didn't have UTF-8/Unicode support at all.

Workarounds:
Don't use Unicode in json_encode/decode
Lummox JR resolved issue with message:
json_encode() didn't handle UTF-8 characters correctly.