Subject: | JSON::Syck party violates RFC 4627 (implicit values) |
JSON not allows single-quoted string literal but some string like
bool/null are single-quoted. Ruby's json does not parse this correctly.
* http://www.ietf.org/rfc/rfc4627.txt
Subject: | json-usedoublequote.t |
use strict;
use t::TestYAML ();
use Test::More tests => 14;
use JSON::Syck;
{
# RFC 4627 only allows double-quoted string.
$JSON::Syck::SingleQuote = 0;
my $t;
$t = JSON::Syck::Dump({ foo => "y" });
like $t, qr/"y"/;
$t = JSON::Syck::Dump({ foo => "n" });
like $t, qr/"n"/;
$t = JSON::Syck::Dump({ foo => "yes" });
like $t, qr/"yes"/;
$t = JSON::Syck::Dump({ foo => "no" });
like $t, qr/"no"/;
$t = JSON::Syck::Dump({ foo => "true" });
like $t, qr/"true"/;
$t = JSON::Syck::Dump({ foo => "false" });
like $t, qr/"false"/;
$t = JSON::Syck::Dump({ foo => "null" });
like $t, qr/"null"/;
}
{
# Violate RFC but needed?
$JSON::Syck::SingleQuote = 1;
my $t;
$t = JSON::Syck::Dump({ foo => "y" });
like $t, qr/'y'/;
$t = JSON::Syck::Dump({ foo => "n" });
like $t, qr/'n'/;
$t = JSON::Syck::Dump({ foo => "yes" });
like $t, qr/'yes'/;
$t = JSON::Syck::Dump({ foo => "no" });
like $t, qr/'no'/;
$t = JSON::Syck::Dump({ foo => "true" });
like $t, qr/'true'/;
$t = JSON::Syck::Dump({ foo => "false" });
like $t, qr/'false'/;
$t = JSON::Syck::Dump({ foo => "null" });
like $t, qr/'null'/;
}
Subject: | emitter.c.usedoublequote.diff |
--- YAML-Syck-1.01.orig/emitter.c 2007-12-12 08:28:02.000000000 +0900
+++ YAML-Syck-1.01/emitter.c 2008-02-04 17:03:17.000000000 +0900
@@ -684,7 +684,7 @@
&&
(len > 0)
) {
- force_style = scalar_1quote;
+ force_style = (force_style == scalar_2quote) ? scalar_2quote : scalar_1quote;
} else {
/* complex key -- disabled by Audrey Tang -/
if ( parent->status == syck_lvl_map && parent->ncount % 2 == 1 &&