[Issue 17555] New: [REG2.070.0] Control characters in JSON data are invalid and should cause an exception
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jun 26 00:59:00 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17555
Issue ID: 17555
Summary: [REG2.070.0] Control characters in JSON data are
invalid and should cause an exception
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: dlang-bugzilla at thecybershadow.net
As per the JSON spec, raw control characters are not allowed in Unicode data. D
correctly threw upon encountering them before 2.070.0.
Test case:
//////////////// test.d ////////////////
import std.exception;
import std.json;
void main()
{
assertThrown(parseJSON("\"a\nb\""));
}
////////////////////////////////////////
After 2.070, parseJSON returns nonsense data:
writeln(parseJSON("\"a\nb\"").str)
produces:
a\u000Ab
(i.e. the characters are "escaped" despite being decoded, not encoded).
Introduced in https://github.com/dlang/phobos/pull/3872
--
More information about the Digitalmars-d-bugs
mailing list