Subject: | JSON::Syck: Extra spaces in single-quoted URLs |
Hi, there~
It's common that users use single quoted literals in their JSON inputs.
When they put URLs, JSON::Syck introduced extra spaces in the values.
Here's the test file that exercise the bug:
use strict;
use warnings;
use Test::More tests => 2;
use JSON::Syck 'Load';
my $url = 'http://www.pugscode.org';
my $var = Load(<<_EOC_);
{ url: '$url' }
_EOC_
ok $var, "JSON load OK";
is $var->{url}, $url, "no extra space in the URL";
Here's the output on my machine (perl 5.8.8, YAML-Syck 1.00, ubuntu 7.10):
1..2
ok 1 - JSON load OK
not ok 2 - no extra space in the URL
# Failed test 'no extra space in the URL'
# at t.t line 12.
# got: 'http: //www.pugscode.org'
# expected: 'http://www.pugscode.org'
# Looks like you failed 1 test of 2.
IMHO, JSON::Syck should
1. croak on single-quoted JSON literals or
2. support single-quoted literals *fully* ;)
Thanks!
-agentzh