摘要: 参考:http://daimajishu.iteye.com/blog/959239不过具测试,也有错误:原文如下:# author: jiangyujieuse utf8; ##在最后一个例子,这里面不能有use utf8;use Encode;use URI::Escape;$\ = "\n";#从unicode得到utf8编码$str = '%u6536';$str =~ s/\%u([0-9a-fA-F]{4})/pack("U",hex($1))/eg;$str = encode( "utf8", $str 阅读全文
posted @ 2014-04-05 09:04 芽滴滴 阅读(2493) 评论(0) 推荐(0) 编辑
摘要: 例子:1. 有php的 json函数生成的中文串[root@tts177:/tmp]$/opt/php/bin/php -r 'echo json_encode(Array("a"=>"测试"))."\n";'{"a":"\u6d4b\u8bd5"}[root@tts177:/tmp]$2. perl代码和执行结果如下:[root@tts177:/tmp]$more uuu.pl #!/usr/bin/perluse warnings;use Data::Dumper;us 阅读全文
posted @ 2014-04-05 08:44 芽滴滴 阅读(2262) 评论(0) 推荐(0) 编辑