zoukankan      html  css  js  c++  java
  • perl lwp get uft-8和gbk

    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;;
    };

  • 相关阅读:
    vue学习6
    vue学习5
    vue学习3
    vue学习2
    vue学习1
    idea快速查找和替换快捷键
    mysql三元表达式
    1 Java Lambda表达式forEach无法跳出循环的解决思路
    6 Mybatis Plus and 和 or,分页Page使用
    4 Mybatis Plus使用redis作为二级缓存
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350888.html
Copyright © 2011-2022 走看看