perl 编码问题;
use utf8表示代码使用UTF-8写的
[root@wx03 0710]# cat a1.pl
#use utf8;
my $str='测试utf8字符集';
print $str."\n";
[root@wx03 0710]# perl a1.pl
测试utf8字符集
[root@wx03 0710]# cat a1.pl
use utf8;
my $str='测试utf8字符集';
print $str."\n";
[root@wx03 0710]# perl a1.pl
Wide character in print at a1.pl line 3.
测试utf8字符集
[root@dr-mysql01 0710]# cat a1.pl
use utf8;
my $a='验证';
print $a."\n";
my $b=$a;
#my $b=encode_utf8($a);
my $url="http://192.168.32.101:3000/api/getcode?env=zj&phone=18072722237";
use LWP::UserAgent;
use Encode;
#use utf8;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->agent("Mozilla/8.0");
my $response = $ua->get($url);
if ($response->is_success) {
$r= $response->decoded_content;
通过demo搞懂encode_utf8和decode_utf8
最新推荐文章于 2024-06-28 21:28:51 发布