Update JSON-PP to CPAN version 2.27300
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Fri, 10 Oct 2014 12:22:42 +0000 (13:22 +0100)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Fri, 10 Oct 2014 12:22:42 +0000 (13:22 +0100)
  [DELTA]

2.27300
  - fixed a problem about substr in perl 5.8.6 and below
    many people report this issue and patched by haarg[at]haarg.org

MANIFEST
Porting/Maintainers.pl
cpan/JSON-PP/lib/JSON/PP.pm
cpan/JSON-PP/t/zero-mojibake.t [new file with mode: 0644]

index 8abdcfe..ef6cf27 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1418,6 +1418,7 @@ cpan/JSON-PP/t/114_decode_prefix.t
 cpan/JSON-PP/t/115_tie_ixhash.t
 cpan/JSON-PP/t/116_incr_parse_fixed.t
 cpan/JSON-PP/t/_unicode_handling.pm
+cpan/JSON-PP/t/zero-mojibake.t
 cpan/libnet/Config.eg          libnet
 cpan/libnet/Hostname.pm.eg     libnet
 cpan/libnet/Makefile.PL
index 21b6a3f..1c5342c 100755 (executable)
@@ -675,7 +675,7 @@ use File::Glob qw(:case);
     },
 
     'JSON::PP' => {
-        'DISTRIBUTION' => 'MAKAMAKA/JSON-PP-2.27203.tar.gz',
+        'DISTRIBUTION' => 'MAKAMAKA/JSON-PP-2.27300.tar.gz',
         'FILES'        => q[cpan/JSON-PP],
     },
 
index c1b4f1b..7a011a4 100644 (file)
@@ -11,7 +11,7 @@ use Carp ();
 use B ();
 #use Devel::Peek;
 
-$JSON::PP::VERSION = '2.27203';
+$JSON::PP::VERSION = '2.27300';
 
 @JSON::PP::EXPORT = qw(encode_json decode_json from_json to_json);
 
@@ -655,6 +655,7 @@ BEGIN {
         }
         else {
             utf8::upgrade( $text );
+            utf8::encode( $text );
         }
 
         $len = length $text;
@@ -806,17 +807,12 @@ BEGIN {
                 else{
 
                     if ( ord $ch  > 127 ) {
-                        if ( $utf8 ) {
-                            unless( $ch = is_valid_utf8($ch) ) {
-                                $at -= 1;
-                                decode_error("malformed UTF-8 character in JSON string");
-                            }
-                            else {
-                                $at += $utf8_len - 1;
-                            }
+                        unless( $ch = is_valid_utf8($ch) ) {
+                            $at -= 1;
+                            decode_error("malformed UTF-8 character in JSON string");
                         }
                         else {
-                            utf8::encode( $ch );
+                            $at += $utf8_len - 1;
                         }
 
                         $is_utf8 = 1;
@@ -1630,7 +1626,7 @@ JSON::PP - JSON::XS compatible pure-Perl module.
 
 =head1 VERSION
 
-    2.27202
+    2.27300
 
 L<JSON::XS> 2.27 (~2.30) compatible.
 
@@ -2791,7 +2787,7 @@ Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2007-2013 by Makamaka Hannyaharamitu
+Copyright 2007-2014 by Makamaka Hannyaharamitu
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself. 
diff --git a/cpan/JSON-PP/t/zero-mojibake.t b/cpan/JSON-PP/t/zero-mojibake.t
new file mode 100644 (file)
index 0000000..9a9741f
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More;
+BEGIN { plan tests => 1 };
+
+BEGIN { $ENV{PERL_JSON_BACKEND} = 0; }
+
+use JSON::PP;
+
+my $json = JSON::PP->new;
+
+my $input = q[
+{
+   "dynamic_config" : 0,
+   "x_contributors" : [
+      "大沢 å\92\8cå®\8f",
+      "Ã\86var Arnfjörð"
+   ]
+}
+];
+eval { $json->decode($input) };
+is $@, '', 'decodes 0 with mojibake without error';