June 26, 2017 [Issue 17555] New: [REG2.070.0] Control characters in JSON data are invalid and should cause an exception | ||||
|---|---|---|---|---|
| ||||
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@puremagic.com Reporter: dlang-bugzilla@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 -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply