gbk编码:

jrhmpt01:/root/lwp# cat x2.pl
use LWP::UserAgent;
use DBI;
$user="root";
$passwd='R00t,uHagt.0511';
$dbh="";
$dbh = DBI->connect("dbi:mysql:database=zjzc_vote;host=114.55.5.57;port=3306",$user,$passwd) or die "can't connect to database ". DBI-errstr;
$dbh->do("SET NAMES utf8");
use POSIX;
use Data::Dumper;
use HTML::TreeBuilder;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->agent("Mozilla/8.0");
my $response = $ua->get('http://data.10jqka.com.cn/financial/yjyg/date/2016-03-31/ajax/1/');
if ($response->is_success) {
print $response->content;
};
jrhmpt01:/root/lwp# echo $LANG
en_US utf8编码: jrhmpt01:/root/lwp# echo $LANG
en_US.UTF-8
jrhmpt01:/root/lwp# cat x2.pl
use LWP::UserAgent;
use DBI;
$user="root";
$passwd='R00t,uHagt.0511';
$dbh="";
$dbh = DBI->connect("dbi:mysql:database=zjzc_vote;host=114.55.5.57;port=3306",$user,$passwd) or die "can't connect to database ". DBI-errstr;
$dbh->do("SET NAMES utf8");
use POSIX;
use Data::Dumper;
use HTML::TreeBuilder;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->agent("Mozilla/8.0");
my $response = $ua->get('http://data.10jqka.com.cn/financial/yjyg/date/2016-03-31/ajax/1/');
if ($response->is_success) {
print $response->decoded_content;;
};

perl lwp get uft-8和gbk的更多相关文章

  1. perl lwp 超时问题

    lwp 超时问题: jrhmpt01:/root/async# cat a1.pl use LWP::UserAgent; use utf8; use DBI; use POSIX; use Data ...

  2. perl lwp关闭ssl校验

    use LWP::UserAgent; use HTTP::Cookies; use HTTP::Headers; use HTTP::Response; use Encode; use File:: ...

  3. perl lwp 默认的请求头

    </pre><pre name="code" class="html">[root@dr-mysql01 ~]# cat getx.pl ...

  4. perl lwp 获取请求头

    <pre name="code" class="html">[root@dr-mysql01 ~]# cat getx.pl use LWP::Us ...

  5. perl LWP::UserAgent获取源码与响应

    #!/usr/bin/perl -w use strict; use LWP::UserAgent; my $useragent = new LWP::UserAgent; my $url = 'ht ...

  6. perl lwp编码

    $var= $response->content; $var= $response->decoded_content;

  7. [Perl]抓取个人的所有闪存+格式化保存为文本

    以下代码保存为utf8文本格式 环境:ActivePerl v5.16 built for MSWin32-x86 两个要调整的地方: for my $i (17..45) {  这里改成自己对应的页 ...

  8. Perl系列文章

    0.Perl书籍推荐 Perl书籍下载 密码:kkqx 下面是一些我学习Perl过程中读过完整的或部分章节的觉得好的书. 入门级别1:<Perl语言入门>即小骆驼 入门级别2:<In ...

  9. (转) [it-ebooks]电子书列表

    [it-ebooks]电子书列表   [2014]: Learning Objective-C by Developing iPhone Games || Leverage Xcode and Obj ...

随机推荐

  1. C语言处理CSV文件的方法(二)

    strtok函数的使用是一个老生常谈的问题了.该函数的作用很大,争议也很大.以下的表述可能与一些资料有区别或者说与你原来的认识有差异,因此,我尽量以实验为证.交代一下实验环境是必要的,win7+vc6 ...

  2. JQuery使用on绑定动态生成元素时碰到的问题

    今天在写界面时,希望对一些由JS代码动态添加的html标签进行事件绑定,使用了jquery 1.6+才提供的on函数.我的JQ版本是1.9.2. 以下这段代码是动态生成的. <div class ...

  3. Flink资料(3)-- Flink一般架构和处理模型

    Flink一般架构和处理模型 本文翻译自General Architecture and Process Model ----------------------------------------- ...

  4. 《转》读discuzx3.1 数据库层笔记

    最近开始在看discuzx3.1的代码,看到数据库层的实现,discuzx的数据库层能够支撑数据库分库,分布式部署,主要水平分表,也可以很方便的支持其他数据库.性能上,可以做读写分离,支持数据缓存.可 ...

  5. silverlight依赖属性

    依赖属性(Dependency Property)和附加属性(Attached Property) 参考 http://www.cnblogs.com/KevinYang/archive/2010/0 ...

  6. spring常量值注入

    <context:property-placeholder location="classpath:resources/*.properties" /> @Value( ...

  7. Android之CookieStore的持久化

    CookieStore是一个对象,有的服务端 ,比如.net,保持登录状态不是用httpclient.addHeader(“cookie”,SessionId),而是用httppost.setCook ...

  8. 十度好友问题(DFS经典应用)

    问题: 在社交网络里(比如 LinkedIn),如果A和B是好友,B和C是好友,但是A和C不是好友,那么C是A的二度好友,给定一个社交网络的关系图,如何找到某一个人的所有十度好友.

  9. C语言入门(7)——自定义函数

    C源程序是由函数组成的.虽然在C语言入门系列前面几篇的程序中大都只有一个主函数main(),但实用程序往往由多个函数组成.函数是C源程序的基本模块,通过对函数模块的调用实现特定的功能.C语言中的函数相 ...

  10. golang仿AS3写的ByteArray

    用golang写了个仿AS3写的ByteArray,稍微有点差别,demo能成功运行,还未进行其他测试 主要参考的是golang自带库里的Buffer,结合了binary 来看看demo: packa ...