centos6.5:/root/test#cat a2.pl
use Net::SMTP;
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Headers;
use HTTP::Response;
use Encode;
use JSON;
use File::Temp qw/tempfile/;
use HTTP::Date qw(time2iso str2time time2iso time2isoz);
use Data::Dumper;
my $CurrTime = time2iso(time());
my $dis_mainpublish='中均资本';
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
my $now = time();
$ua->agent('Mozilla/5.0');
my $cookie_jar = HTTP::Cookies->new( file => 'lwp_cookies.txt',
autosave => 1,
ignore_discard => 1
);
$ua->cookie_jar($cookie_jar);
my $response = $ua->get("https://www.zjcap.cn/web/noauth?method=%2Fproduct%2Flist&duration=&entryUnit=&productType=1&status=&yield=&productName=&pageNum=1&pageSize=6&_=1468156037154"); if ($response->is_success) {
$r = $response->decoded_content;
print "\n";
}
else
{
die $response->status_line;
};
#my $r=encode_utf8($r);
my $hash = decode_json ( $r );
print "11111111111111111111\n";
print "产品列表\n";
print $hash->{data}->{dataList}->[0]->{name};
print "\n";
centos6.5:/root/test#perl a2.pl 11111111111111111111
产品列表
Wide character in print at a2.pl line 40.
爱晚-融通宝第9期 因为decode_json必须是unicode字符 ,返回的json数据前需要转成unicode my $r=encode_utf8($r); centos6.5:/root/test#cat a2.pl
use Net::SMTP;
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Headers;
use HTTP::Response;
use Encode;
use JSON;
use File::Temp qw/tempfile/;
use HTTP::Date qw(time2iso str2time time2iso time2isoz);
use Data::Dumper;
my $CurrTime = time2iso(time());
my $dis_mainpublish='中均资本';
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
my $now = time();
$ua->agent('Mozilla/5.0');
my $cookie_jar = HTTP::Cookies->new( file => 'lwp_cookies.txt',
autosave => 1,
ignore_discard => 1
);
$ua->cookie_jar($cookie_jar);
my $response = $ua->get("https://www.zjcap.cn/web/noauth?method=%2Fproduct%2Flist&duration=&entryUnit=&productType=1&status=&yield=&productName=&pageNum=1&pageSize=6&_=1468156037154"); if ($response->is_success) {
$r = $response->decoded_content;
print "\n";
}
else
{
die $response->status_line;
};
my $r=encode_utf8($r);
my $hash = decode_json ( $r );
print "11111111111111111111\n";
print "产品列表\n";
print $hash->{data}->{dataList}->[0]->{name};
print "\n";
centos6.5:/root/test#perl a2.pl 11111111111111111111
产品列表
爱晚-融通宝第9期

Wide character in print at a2.pl line 返回json 需要encode_utf8的更多相关文章

  1. Wide character in print at a2.pl line 6.

    jrhapt01:/home/tomcat/test> cat a2.pl my $str="$ARGV[0]"; use Encode; use URI::Escape; ...

  2. perl unload utf-8 oracle Wide character in print at unload_oracle.pl line 105.

    #!/usr/bin/perl use DBI; use Encode; my $dbName = 'oadb'; my $dbUser = 'vxspace'; my $dbUserPass = ' ...

  3. Wide character in print at hcp.pl line 21.

    jrhmpt01:/root# cat -n hcp.pl 1 use LWP::UserAgent; 2 use Encode; 3 $ua = LWP::UserAgent->new; 4 ...

  4. 为什么出现Wide character in print at a14.pl line 41

    [root@wx03 ~]# cat a14.pl use Net::SMTP; use LWP::UserAgent; use HTTP::Cookies; use HTTP::Headers; u ...

  5. php 返回json 解析 报Wide character in print

    php 返回json: zabbix:/var/www/html/DEVOPS/Home/Lib/Action# vim EquipmentAction.class.php <?php head ...

  6. Can't locate find.pl in @INC (@INC contains: /etc/perl xxxx) at perlpath.pl line 7.

    /********************************************************************** * Can't locate find.pl in @I ...

  7. error: converting to execution character set: Invalid or incomplete multibyte or wide character

    交叉编译.c文件,遇到如下问题 arm-linux-gcc -o show_lines show_lines.c -lfreetype -lm show_lines.c:199:19: error: ...

  8. SyntaxError: Non-ASCII character 'æ' in file csdn.py on line 7, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

    错误信息: SyntaxError: Non-ASCII character , but no encoding declared; see http://python.org/dev/peps/pe ...

  9. 编译内核错误:Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373

    最近在编译一个新的rk sdk的时候,编译内核报错 CHK include/linux/version.h CHK include/generated/utsrelease.h make[1]: 'i ...

随机推荐

  1. [ lucene高级 ] 研讨如何进行Lucene的分布式应用

    http://www.cnblogs.com/huangfox/archive/2010/10/15/1852206.html Lucene是个高度优化的倒转索引搜索引擎.它将倒转的索引存储在定制的文 ...

  2. 20160420javaweb之文件上传和下载

    一.文件上传 1.提供表单允许用户通过表单选择文件进行上传 表单必须是POST提交 文件输入框必须有name属性,只有有name属性的输入项浏览器才会进行提交 需要设置enctype属性值为multi ...

  3. java反射技术

    Class c2 = Class.forName("com.reflection.Test"); // 对类的寻找,找到一个类,注意不是对象 WifiManager mWifiMa ...

  4. 小改动,大作为——C# 4.0中的微小改动

    1.可选参数和命名实参 可选参数和命名实参就如同一对好基友,因为它们经常一起使用. 1.1 可选参数 可选参数重在“可选”,即在调用方法时,该参数可以明确指定实参,也可以不指定.如下代码所示,下面代码 ...

  5. windows server 2003 禁止开机显示“关闭事件跟踪”

    关机事件跟踪(Shutdown   Event   Tracker)也是Windows   server   2003区别于其他工作站系统的一个设置,对于服务器来说这是一个必要的选择,但是对于工作站系 ...

  6. Win7下Boost库的安装

    Boost库是C++领域公认的经过千锤百炼的知名C++类库,涉及编程中的方方面面,简单记录一下使用时的安装过程 1.boost库的下载 boost库官网主页:www.boost.org 2.安装 将下 ...

  7. CentOS7修改网卡为eth0

    CentOS7修改网卡为eth0 1.编辑网卡信息 [root@linux-node2~]# cd /etc/sysconfig/network-scripts/  #进入网卡目录 [root@lin ...

  8. jQuery学习 day01

    最近受某大牛指点(我不会说他姓范),了解了一下jQuery,据说很牛X,就了解了一下,第一天,分享给大家一些心得吧. 1.首先就是导入jQuery文件了,这里我是去jQuery官网下载的.(大家可以去 ...

  9. docker的基本使用

    docker 基本的使用命令docker pull centos:latestdocker images centosdocker run -i -t centos /bin/bash //也可以使用 ...

  10. jquery api 笔记(2) 事件 事件对象

    事件 #1.resize()     缩放窗体:window.resizeTo(width, height); 并不是兼容做法.   #2 .scroll() ->获取滚动条的位置: .scro ...