为什么出现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;
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 Dumper($hash);
print "产品列表\n";
print $hash->{data}->{dataList}->[0]->{name}; [root@wx03 ~]# perl a14.pl 11111111111111111111
产品列表
Wide character in print at a14.pl line 41.
中均-欧洲杯18号(葡萄牙加时/点球夺冠)[root@wx03 ~]# 为什么出现Wide character in print at a14.pl line 41. 呢/ 因为my $hash = decode_json ( $r ); $r 没有转换成utf-8 binary string /**************************************************** [root@wx03 ~]# cat a14.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 Dumper($hash);
print "产品列表\n";
print $hash->{data}->{dataList}->[0]->{name};
[root@wx03 ~]# perl a14.pl 11111111111111111111
产品列表
中均-欧洲杯18号(葡萄牙加时/点球夺冠)[root@wx03 ~]#
为什么出现Wide character in print at a14.pl line 41的更多相关文章
- 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 = ' ...
- Wide character in print at a2.pl line 返回json 需要encode_utf8
centos6.5:/root/test#cat a2.pl use Net::SMTP; use LWP::UserAgent; use HTTP::Cookies; use HTTP::Heade ...
- 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; ...
- 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 ...
- php 返回json 解析 报Wide character in print
php 返回json: zabbix:/var/www/html/DEVOPS/Home/Lib/Action# vim EquipmentAction.class.php <?php head ...
- 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: ...
- 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 ...
- Lua print on the same line
In Pascal, I have write and writeln. Apparently Lua's print is similar to writeln of Pascal. Do we h ...
- pyhon SyntaxError: Non-ASCII character '\xe8' in file xxx on line xx, but no encoding
import math if __name__ == '__main__': name1 = raw_input("请输入您的编号:") print name1 完整的 ...
随机推荐
- Datamatrix码
DataMatrix二维条码原名Datacode,由美国国际资料公司(International Data Matrix, 简称ID Matrix)於1989年发明.DataMatrix二维条码是一种 ...
- mysql merge table
SELECT COUNT(*) FROM `comment` SHOW CREATE TABLE `comment` CREATE TABLE `comment1` ( `id` INT(8) NOT ...
- linux 命令之sar——监视系统状态
摘要:在进行系统或者内核测试的时候,我们经常需要观察cpu利用率,缓冲区使用情况,文件读写情况等等.在linux系统下,我们可以用sar命令来达到这个要求. sar 命令行的常用格式: sar [op ...
- Windows下搭建deepnet环境
近期在做deep learning的项目,学习了一下deepnet,之前搭建了一个windows下的deepnet的学习开发环境,把搭建系统的过程分享给大家. 1.我用的是windows下的visua ...
- 将其它图片格式转为.eps格式
假设是用origin的话就不存在这个问题. 倘若你是用excel绘图的话. 1.先将excel导出为.pdf文件 2.用Adobe Acrobat Pro 打开pdf,用其它的pdf软件貌似不行 3. ...
- 【Eclipse】修改项目访问名称
Properties --> Web Project Settings --> Context root --> 输入想要用的名称(默认是项目名)
- iOS 拍照保存到相册
之前看了一些开源的代码,里面有一个功能,就是将图片下载到相册,仔细看了其中的代码,只有很简单的一句话,并且保存过后,还可以判断是否保存成功. 如下代码所示, 点击按钮,将self.imageView上 ...
- SGU 183. Painting the balls( dp )
dp..dp(i, j)表示画两个点为i-j, i的最优答案. dp(i, j) = min{ dp(i-j, k) } + cost[i] (1≤k≤M-j) 令f(i, j) = min{dp(i ...
- BZOJ 2101: [Usaco2010 Dec]Treasure Chest 藏宝箱( dp )
dp( l , r ) = sum( l , r ) - min( dp( l + 1 , r ) , dp( l , r - 1 ) ) 被卡空间....我们可以发现 l > r 是无意义的 ...
- JSONToObejct 问题 part 1
直接截图,就明白了 前端的处理 这里用到 JSON2.stringify() 这个方法是将对象(object) 转换成 [{},{},+...+,{}] 这种键值对形式的数据,不然rows只是一个选 ...