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