digitalmars.D - non-standard json output
- Anthony Goins (8/8) Jun 04 2013 Is this a bug?
- Brian Schott (5/13) Jun 04 2013 Where does the standard say that forward slashes have to be
- Anthony Goins (14/32) Jun 04 2013 any-Unicode-character-
- Brian Schott (8/8) Jun 04 2013 The "char" rule in the json standard can be matched by anything
- Anthony Goins (11/19) Jun 04 2013 I appreciate your taking time to enlighten me.
- Anthony Goins (2/20) Jun 04 2013 Thanks, I get it now.
- Alix Pexton (11/19) Jun 05 2013 I looked into this out of curiosity.
Is this a bug? "file" : "/home/anthony/projects/dcomposer/src/printui.d", A line from DMD 2.063 json output. "file" : "\/usr\/include\/d\/gsv\/SourceBuffer.d", A line from an older DMD version. Forward slashes escaped according to json standard. Hesitant to file a bug report because by the time I see something it's probably already well known and fixed.
Jun 04 2013
On Tuesday, 4 June 2013 at 20:59:55 UTC, Anthony Goins wrote:Is this a bug? "file" : "/home/anthony/projects/dcomposer/src/printui.d", A line from DMD 2.063 json output. "file" : "\/usr\/include\/d\/gsv\/SourceBuffer.d", A line from an older DMD version. Forward slashes escaped according to json standard. Hesitant to file a bug report because by the time I see something it's probably already well known and fixed.Where does the standard say that forward slashes have to be escaped? It shows in the syntax diagram that you CAN escape it, but there is no requirement to do so as it is a unicode character other than '"' or '\'
Jun 04 2013
On Tuesday, 4 June 2013 at 21:35:27 UTC, Brian Schott wrote:On Tuesday, 4 June 2013 at 20:59:55 UTC, Anthony Goins wrote:any-Unicode-character- except-"-or-\-or- control-character \" \\ \/ \b \f \n \r \t \u four-hex-digits from "http://www.json.org/"Is this a bug? "file" : "/home/anthony/projects/dcomposer/src/printui.d", A line from DMD 2.063 json output. "file" : "\/usr\/include\/d\/gsv\/SourceBuffer.d", A line from an older DMD version. Forward slashes escaped according to json standard. Hesitant to file a bug report because by the time I see something it's probably already well known and fixed.Where does the standard say that forward slashes have to be escaped? It shows in the syntax diagram that you CAN escape it, but there is no requirement to do so as it is a unicode character other than '"' or '\'
Jun 04 2013
The "char" rule in the json standard can be matched by anything that isn't a control character, a double quote, or a backslash. I'm pretty sure you're not arguing that the forward slash is a double quote or that the forward slash is a backslash, so the only option left is that '/' is a control character, and thus needs escaping. I'm pretty sure that it's not, because 002f is not in the range defined as a control character[1] [1] http://www.unicode.org/glossary/#control_codes
Jun 04 2013
On Tuesday, 4 June 2013 at 21:55:38 UTC, Brian Schott wrote:The "char" rule in the json standard can be matched by anything that isn't a control character, a double quote, or a backslash. I'm pretty sure you're not arguing that the forward slash is a double quote or that the forward slash is a backslash, so the only option left is that '/' is a control character, and thus needs escaping. I'm pretty sure that it's not, because 002f is not in the range defined as a control character[1] [1] http://www.unicode.org/glossary/#control_codesI appreciate your taking time to enlighten me. I almost get it. b is b \b is backspace f is f \f is formfeed / is / but what the heck is \/ This is a rhetorical post. Go back to being productive ;)
Jun 04 2013
On Tuesday, 4 June 2013 at 21:35:27 UTC, Brian Schott wrote:On Tuesday, 4 June 2013 at 20:59:55 UTC, Anthony Goins wrote:Thanks, I get it now.Is this a bug? "file" : "/home/anthony/projects/dcomposer/src/printui.d", A line from DMD 2.063 json output. "file" : "\/usr\/include\/d\/gsv\/SourceBuffer.d", A line from an older DMD version. Forward slashes escaped according to json standard. Hesitant to file a bug report because by the time I see something it's probably already well known and fixed.Where does the standard say that forward slashes have to be escaped? It shows in the syntax diagram that you CAN escape it, but there is no requirement to do so as it is a unicode character other than '"' or '\'
Jun 04 2013
On 04/06/2013 9:59 PM, Anthony Goins wrote:Is this a bug? "file" : "/home/anthony/projects/dcomposer/src/printui.d", A line from DMD 2.063 json output. "file" : "\/usr\/include\/d\/gsv\/SourceBuffer.d", A line from an older DMD version. Forward slashes escaped according to json standard. Hesitant to file a bug report because by the time I see something it's probably already well known and fixed.I looked into this out of curiosity. The solidus _can be_ escaped to allow JSON strings to contain XML closing tags (like </b>) while the JSON itself is wrapped by an XML element. In contexts where the JSON is not going to be read by an XML parser, or will not make a potentially confusing closing tag (such as in part of a web address or file path) it becomes totally optional. However, I also read that some buggy implementations of JSON parsers treat // as the beginning of a comment even when inside a string. I hope that helps! A...
Jun 05 2013