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

  • 相关阅读:
    AE旋转
    AE2
    AE1
    面试
    TS 基础数据类型
    vue-cli结构介绍
    js异步加载的5种方式
    slot 插槽的使用
    使用组件的细节点
    Vue 条件渲染
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6200217.html
Copyright © 2011-2022 走看看