chris

平平安安
Perl utf8 gbk gb2312

#!/usr/bin/perl -w
use strict;
use Encode;
#gbk TO uft-8
my $str;
$str = encode("utf-8",decode("gbk",$str));
#$str = encode_utf8(decode("gbk",$str)); # Or use this method
# uft-8 TO gb2312:
$str = encode("gb2312", decode("utf8", $str));
#utf-8 TO gbk
#$str = encode("gbk", decode("utf8", $str));

posted on 2010-09-03 09:56  chrisfu  阅读(367)  评论(0)    收藏  举报