2007/05/06

Perl 5.8 PerlIO feature

With the new PerlIO feature and Unicode support in Perl 5.8, it is possible to do the internal encoding change with only a few lines of code.

Please check the code below. It will be able to read the GBK input from STDIN and convert it to UTF-8 to STDOUT. :)


#!/usr/bin/perl -W

use encoding "gbk", STDOUT => "utf8";
while(<>){print};


Power and Simple. :D
发表评论