#unicode编码转换为gbk中文
my $data = "\u5317\u4eac";
my $rs = $data =~ s/\u([^\\]{4})/\\x{$1}/g;
eval('$data = "' . $data . '";');
print encode('gbk', decode_utf8($data));
#将gbk转换为 unicode编码
printf("}", $_) for unpack('U*', decode('gbk', '北京'));
阅读(1466) | 评论(0) | 转发(0) |