ID:2648073
 
Resolved
json_decode() wasn't handling Unicode characters properly.
BYOND Version:513
Operating System:Windows 10 Pro
Web Browser:Chrome 89.0.4343.0
Applies to:Dream Daemon
Status: Resolved (513.1540)

This issue has been resolved.
Descriptive Problem Summary:
Seems json_decode() doesn't have unicode support.
When you use json_encode, it stores data, but decoding it with json_decode() removes all Cyrillic and unicode chars.

Numbered Steps to Reproduce Problem:
1. use json_encode() to encode unicode message.
2. use json_decode() to decode encoded message.

Code Snippet (if applicable) to Reproduce Problem:
var/list/msg = list("message" = "abc Вкусные hij пирожки efg")
var/json_string = json_encode(msg)
world.log << "1 [json_string]"
msg = json_decode(json_string)
world.log << "2 [msg["message"]]"


Expected Results:
1 {"message":"abc \u0412\u043a\u0443\u0441\u043d\u044b\u0435 hij \u043f\u0438\u0440\u043e\u0436\u043a\u0438 efg"}
2 abc &#1042;&#1082;&#1091;&#1089;&#1085;&#1099;&#1077; hij &#1087;&#1080;&#1088;&#1086;&#1078;&#1082;&#1080; efg


Actual Results:
1 {"message":"abc \u0412\u043a\u0443\u0441\u043d\u044b\u0435 hij \u043f\u0438\u0440\u043e\u0436\u043a\u0438 efg"}
2 abc hij efg


Does the problem occur:
Every time? Or how often? Every time when you use json_decode()
In other games? Yes.
In other user accounts? Yes
On other computers? Yes.

When does the problem NOT occur?
It occurs every time when you use json_decode with unicode chars.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Don't know.

Workarounds: Didn't use.

Lummox JR resolved issue with message:
json_decode() wasn't handling Unicode characters properly.