16进制转换为中文字符串

[root@dr-mysql01 ~]# cat x5.pl
use Encode;
use JSON; 
use URI::Escape;
use LWP::Simple;
my $host = "http://ip.taobao.com/service/getIpInfo.php?ip=202.101.172.35";
my $content = get($host);
print "\$content  is $content\n";


$content =~ s/\\u([0-9a-fA-F]{4})/pack("U",,hex($1))/eg; 

print "\$content  is $content\n";

use Data::Dumper;

my $json_out= Dumper($content); 
print "\$json_out is $json_out\n"
You have mail in /var/spool/mail/root
[root@dr-mysql01 ~]# perl x5.pl
$content  is {"code":0,"data":{"country":"\u4e2d\u56fd","country_id":"CN","area":"\u534e\u4e1c","area_id":"300000","region":"\u6d59\u6c5f\u7701","region_id":"330000","city":"\u676d\u5dde\u5e02","city_id":"330100","county":"","county_id":"-1
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付 29.90元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值