Bug 17556 – std.json encodes non-BMP characters incorrectly with JSONOptions.escapeNonAsciiChars

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-06-26T08:33:42Z
Last change time
2018-01-05T13:29:29Z
Keywords
pull
Assigned to
Vladimir Panteleev
Creator
Vladimir Panteleev
See also
https://issues.dlang.org/show_bug.cgi?id=5904

Comments

Comment #0 by dlang-bugzilla — 2017-06-26T08:33:42Z
/////////////////// test.d /////////////////// import std.json; import std.stdio; void main() { auto v = JSONValue("\U0001D11E"); writeln(toJSON(v, false, JSONOptions.escapeNonAsciiChars)); } ////////////////////////////////////////////// Above program prints "\uD11E", which is not the correct character. Non-BMP characters should be encoded as a pair of escaped UTF-16 surrogate pairs, as per RFC 4627. See also issue 5904.
Comment #1 by dlang-bugzilla — 2017-06-26T10:03:41Z
Comment #2 by github-bugzilla — 2017-07-03T09:07:43Z
Commit pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/941e2936b6c90fce0b11eada9605c231ca498e9f Fix Issue 17556 - std.json encodes non-BMP characters incorrectly with JSONOptions.escapeNonAsciiChars
Comment #3 by github-bugzilla — 2017-07-08T17:09:23Z
Commit pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/941e2936b6c90fce0b11eada9605c231ca498e9f Fix Issue 17556 - std.json encodes non-BMP characters incorrectly with JSONOptions.escapeNonAsciiChars
Comment #4 by github-bugzilla — 2018-01-05T13:29:29Z
Commit pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/941e2936b6c90fce0b11eada9605c231ca498e9f Fix Issue 17556 - std.json encodes non-BMP characters incorrectly with JSONOptions.escapeNonAsciiChars