dump json 显示中文问题

[root@dr-mysql01 ~]# cat a2.pl 
my $url="http://192.168.32.101:3000/api/getcode?env=zj&phone=18072722237";
use  LWP::UserAgent;
use Encode;
 
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->agent("Mozilla/8.0");

my $response = $ua->get($url);



if ($response->is_success) {
 $r= $response->decoded_content;  # or whatever
}
else {
 die $response->status_line;
};
 use JSON qw/encode_json decode_json/;
 $d       = encode_utf8($r);
 $f       = decode_json($d);
print $f;
print "\n";
use Data::Dumper;
my $var= Dumper($r);
print $var;
print "\n";

my $var= Dumper($d);
print $var;
print "\n";


my $var= Dumper($f);
print $var;
print "\n";
print $f->[0]->[1];
print "\n";
[root@dr-mysql01 ~]# perl a2.pl 
ARRAY(0x23050d8)
$VAR1 = '[["18072722237","ZJ没有找到需要的验证码信息"]]';

$VAR1 = '[["18072722237","ZJ没有找到需要的验证码信息"]]';

$VAR1 = [
          [
            '18072722237',
            "ZJ\x{e6}\x{b2}\x{a1}\x{e6}\x{9c}\x{89}\x{e6}\x{89}\x{be}\x{e5}\x{88}\x{b0}\x{e9}\x{9c}\x{80}\x{e8}\x{a6}\x{81}\x{e7}\x{9a}\x{84}\x{e9}\x{aa}\x{8c}\x{e8}\x{af}\x{81}\x{e7}\x{a0}\x{81}\x{e4}\x{bf}\x{a1}\x{e6}\x{81}\x{af}"
          ]
        ];

ZJ没有找到需要的验证码信息

posted @ 2016-05-20 10:25  czcb  阅读(349)  评论(0编辑  收藏  举报