OLD | NEW |
(Empty) | |
| 1 use strict; |
| 2 use Test::More; |
| 3 |
| 4 BEGIN { plan tests => 3 }; |
| 5 |
| 6 BEGIN { $ENV{PERL_JSON_BACKEND} = "JSON::backportPP"; } |
| 7 |
| 8 use JSON; |
| 9 |
| 10 BEGIN { |
| 11 use lib qw(t); |
| 12 use _unicode_handling; |
| 13 } |
| 14 |
| 15 my $json = JSON->new->allow_nonref->utf8; |
| 16 my $str = '\\u00c8'; |
| 17 |
| 18 my $value = $json->decode( '"\\u00c8"' ); |
| 19 |
| 20 #use Devel::Peek; |
| 21 #Dump( $value ); |
| 22 |
| 23 is( $value, chr 0xc8 ); |
| 24 |
| 25 SKIP: { |
| 26 skip "UNICODE handling is disabale.", 1 unless $JSON::can_handle_UTF16_and_u
tf8; |
| 27 ok( utf8::is_utf8( $value ) ); |
| 28 } |
| 29 |
| 30 eval { $json->decode( '"' . chr(0xc8) . '"' ) }; |
| 31 ok( $@ =~ /malformed UTF-8 character in JSON string/ ); |
| 32 |
OLD | NEW |