perl unicode utf-8 \x转换
来源:互联网 发布:网络用语鸡肋什么意思 编辑:程序博客网 时间:2024/06/16 12:48
[root@dr-mysql01 ~]# cat x5.pluse 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","isp":"\u7535\u4fe1","isp_id":"100017","ip":"202.101.172.35"}}Wide character in print at x5.pl line 12.$content is {"code":0,"data":{"country":"中国","country_id":"CN","area":"华东","area_id":"300000","region":"浙江省","region_id":"330000","city":"杭州市","city_id":"330100","county":"","county_id":"-1","isp":"电信","isp_id":"100017","ip":"202.101.172.35"}}$json_out is $VAR1 = "{\"code\":0,\"data\":{\"country\":\"\x{4e2d}\x{56fd}\",\"country_id\":\"CN\",\"area\":\"\x{534e}\x{4e1c}\",\"area_id\":\"300000\",\"region\":\"\x{6d59}\x{6c5f}\x{7701}\",\"region_id\":\"330000\",\"city\":\"\x{676d}\x{5dde}\x{5e02}\",\"city_id\":\"330100\",\"county\":\"\",\"county_id\":\"-1\",\"isp\":\"\x{7535}\x{4fe1}\",\"isp_id\":\"100017\",\"ip\":\"202.101.172.35\"}}";
0 0
- perl unicode utf-8 \x转换
- Python2.X UNICODE, UTF-8转换
- Unicode转换String UTF-8
- Unicode与UTF-8转换
- utf-8和Unicode转换
- UTF-8向UNICODE转换
- Unicode与UTF-8转换
- unicode与utf-8转换
- PERL GB2312 UTF-8 编码转换
- 将utf-8转换为unicode
- 字符集之间转换(UTF-8,UNICODE,Gb2312)
- 字符集之间转换(UTF-8,UNICODE,Gb2312)
- utf-8编码转换成Unicode
- 字符集之间转换(UTF-8,UNICODE,Gb2312)
- UTF-8到Unicode的编码转换
- 字符集之间转换(UTF-8,UNICODE,Gb2312)
- 字符集之间转换(UTF-8,UNICODE,Gb2312)
- 字符集之间转换(UTF-8,UNICODE,Gb2312)
- 【fuser】验证进程正在使用的文件或套接字文件
- 由SVN转回Dynamsoft SourceAnywhere for VSS
- Linux下的Postfix邮件服务器
- MySQL基础四:表的删除、插入、更新、查找
- iOS tableView刷新选中cell数据
- perl unicode utf-8 \x转换
- Nginx上安装phpMyAdmin
- enum类使用理解2
- linux线程资源回收方法
- VS2010 fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
- 【mke2fs】ext系列文件系统创建管理工具
- 进程与线程的一个简单解释
- uva 10245 The Closest Pair Problem
- 直接插入排序