dump json 显示中文问题
2016-05-20 10:25
495 查看
[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没有找到需要的验证码信息
相关文章推荐
- dump json 显示中文问题
- dump json 显示中文问题
- JSON对象格式美化
- 【.net】json串解析到实体
- AjaxUpLoad.js文件上传插件的使用
- JavaScript:数组增加、删除、翻转、转字符串、取索引、截取(切片)slice、剪接splice、数组合并
- JavaScript-学习一
- JS Date()函数用法
- perl $d = encode_utf8($r); $f = decode_json($d)
- perl $d = encode_utf8($r); $f = decode_json($d)
- perl $d = encode_utf8($r); $f = decode_json($d)
- jsp下拉选框赋值(在js里进行)
- JavaScript RegExp 对象
- javascript笔记---算法基础学习
- C# litJson 使用方法
- 使用百度地图API在页面添加百度地图应用
- jsp iframe example
- javascript的理解及经典案例分析
- javascript的replace+正则 实现ES6的字符串模版
- 12个JavaScript技巧