[DJSON-11] Commas still don't work properly in all cases for removed values via value-fn Created: 16/May/13 Updated: 17/May/13 |
|
| Status: | Open |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | John Stoneham | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
DSON-7 fixes the problem with printing JSON with extra commas, but only as long as the last item is actually printable (the test doesn't appear to demonstrate this, but the keys are iterated in hash order, not insertion order). If the last item's no good, we still have a problem. The best way to handle this without trying to precalculate value-fn for the next value (in case it's not needed) is to insert the comma BEFORE we print the current value, but only if it's not the first thing to be printed. |
| Comments |
| Comment by Andy Fingerhut [ 17/May/13 8:33 AM ] |
|
Doh! Patch djson-11-fix-comma-printing-patch-v1.txt dated May 17 2013 should really fix things, including changing the test to exhibit the problem (before this fix). |
[DJSON-9] Always escape U+2028 and U+2029 to be nice to broken JSON parsers Created: 28/Apr/13 Updated: 28/Apr/13 |
|
| Status: | Open |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Tim McCormack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
U+2028 and U+2029 should be treated like \n and, viz, escaped even when *escape-unicode* is false. A number of JSON parsers (such as ExtJS's) think they can eval JSON in a JS runtime to decode it. This is not true, since JS does not allow U+2028 and U+2029 unescaped in strings: http://timelessrepo.com/json-isnt-a-javascript-subset While this is broken behavior, it is also quite common, so escaping these characters uniformly may ease some developer pain and surprise. |
| Comments |
| Comment by Tim McCormack [ 28/Apr/13 9:46 PM ] |
|
Attached patch. |