perl unicode utf-8 \x转换
[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","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\"}}";
perl unicode utf-8 \x转换的更多相关文章
- 【转】Perl Unicode全攻略
Perl Unicode全攻略 耐心看完本文,相信你今后在unicode处理上不会再有什么问题. 本文内容适用于perl 5.8及其以上版本. perl internal form 在Perl看来, ...
- Perl Unicode全攻略
Perl Unicode全攻略 耐心看完本文,相信你今后在unicode处理上不会再有什么问题. 本文内容适用于perl 5.8及其以上版本. perl internal form 在Perl看来, ...
- Unicode(UTF&UCS)深度历险
Unicode(UTF&UCS)深度历险 计算机网络诞生后,大家慢慢地发现一个问题:一个字节放不下一个字符了!因为需要交流,本地化的文字需要能够被支持. 最初的字符集使用7bit来存储字符,因 ...
- Unicode编码解码在线转换工具
// Unicode编码解码在线转换工具 Unicode 是基于通用字符集(Universal Character Set)的标准来发展,并且同时也以书本的形式(The Unicode Standar ...
- 创建文件夹并解决解决unicode和ASCII码转换的问题
# -*- coding: UTF-8 -*-import sysimport timeimport os #解决unicode和ASCII码转换的问题reload(sys) #解决unicode和A ...
- windows程序设计 Unicode和多字节之间转换
Unicode转多字节:WideCharToMultiByte 多字节转Unicode:MultiByteToWideChar 代码演示 #include <windows.h> int ...
- javascript实现unicode与字符互相转换
javascript实现unicode与字符互相转换. <script language="javascript"> //手机检测 function checkMo ...
- SSIS无法在unicode和非unicode 字符串数据类型之间转换
场景:SSIS从oracle抽到sqlserver,一个表对表到数据仓库ODS层的抽取,没有任何逻辑结果遇到问题: SSIS无法在unicode和非unicode 字符串数据类型之间转换 如下图2个字 ...
- 字符编码(续)---Unicode与ANSI字符串转换以及分辨字符编码形式
Unicode与ANSI字符串转换 我们使用windows函数MultiByteToWideChar将多字节字符串转换为宽字符字符串,如下: int MultiByteToWideChar( UINT ...
- SSIS 无法在 unicode 和非 unicode 字符串数据类型之间转换
最近在学SSIS,遇到一个问题,把平面文件源的数据导入到EXCEL中. 平面文件源的对象是CSV,读进来的PhoneNumber是 DT_STR 然后倒入Excel 对应列建立的是longtext 一 ...
随机推荐
- English - little,a little,a few,few的区别
few.a few.little.a little的区别和联系: few / a few(形容词)用来修饰可数名词,few表示否定意义,没有,几乎没有, a few表示有肯定意思,有几个. 例如:a ...
- C# Attribute(特性)之---契约---[ServiceContract] 、 [OperationContract]
代码如下 : [ServiceContract] //服务协定定义 using System.ServiceModel; public interface IInterface1 { [Operati ...
- Struts2知识总结
整篇参考:http://blog.csdn.net/zq9017197/article/details/5958627 要搞清楚以下几点: 1.Struts2是什么?它的运行原理是什么? 2.Stru ...
- win7系统下连接使用mac 蓝牙键盘(Apple Wireless Keyborad)
这几天买了一个apple wireless keyborad 玩玩,主要是给孩子买了一个ipad 搭配上wireless keyborad让她玩app足够了,就当一部电脑用吧. 看起来挺精致的,可以了 ...
- springmvc入门demo
目录结构: package com.wyl; import org.springframework.stereotype.Controller; import org.springframework. ...
- Centos6.5中 一键安装LNMP 安装Yii2.0 手工配置
1.一键安装LNMP cd /usr wget -c http://soft.vpser.net/lnmp/lnmp1.2-full.tar.gz tar zxf lnmp1.-full.tar.gz ...
- codeforces 633G. Yash And Trees dfs序+线段树+bitset
题目链接 G. Yash And Trees time limit per test 4 seconds memory limit per test 512 megabytes input stand ...
- test md
[TOC] Glossary SUT SYSTEM UNDER TEST CUT CLASS UNDER TEST MUT METHOD UNDER TEST Tests without Use of ...
- VB.NET版机房收费系统---SqlHelper
SqlHelper,最早接触这个词儿的时候,好像是13年的暑假,那个夏天来的比往年来的稍晚一些,呵呵,sqlhelper,翻译成中文就是数据库助手,帮手.百度百科这样对她进行阐述: SqlHelper ...
- SASS组件开发
*:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...