Skip Menu |

This queue is for tickets about the JSON CPAN distribution.

Report information
The Basics
Id: 60128
Status: resolved
Priority: 0/
Queue: JSON

People
Owner: Nobody in particular
Requestors: buzz [...] exotica.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: utf8::is_utf8 on decoded json confusion
Hi, This may or may not be a bug, but I am a little confused. take the following snippet #!/bin/perl use JSON; use Data::Dumper; use Encode; $string = "{\"language\": \"fran\x{c3}\x{a7}ais\"}"; my $json = JSON->new->utf8(1); my $ref = $json->decode($string); print Dumper $ref; $language = $ref->{'language'}; print "Encode::_is_utf8 says true\n" if utf8::is_utf8($language); the output is $VAR1 = { 'language' => "fran\x{e7}ais" }; Encode::_is_utf8 says true as the documentation says the returned string is unicode not utf8 so should the flag be set in this case? running libjson-perl 2.17 and perl v5.10.1
minor typo in that the print line should read print "utf8::is_utf8 says true\n" if utf8::is_utf8($language);
Show quoted text
> as the documentation says the returned string is unicode not utf8 so > should the flag be set in this case? > > running libjson-perl 2.17 and perl v5.10.1
Yes, it works properly. I think that you shouldn't use utf8::is_utf8 unless you know what it does.
On Sun Aug 08 01:01:49 2010, MAKAMAKA wrote: Show quoted text
> > as the documentation says the returned string is unicode not utf8 so > > should the flag be set in this case? > > > > running libjson-perl 2.17 and perl v5.10.1
> > Yes, it works properly. > I think that you shouldn't use utf8::is_utf8 > unless you know what it does. >
Thanks for the reply. I had some odd behaviour which I now see ifsURI.pm v <= 1.35 which doesn't handle this correctly. everything is fine now I have upgraded. appreciate the feedback.