2008年(787)
分类:
2008-09-25 16:05:59
use utf8; |
binmode STDIN, ':utf8'; binmode STDOUT, ':utf8'; # 引用也一样 binmode $in, ':utf8'; binmode $out, ':utf8'; |
utf8::is_utf8($_) || utf8::decode($_) for @ARGV; |
print join("\n", split(//, join(undef, @ARGV))); |
# workaround for functions that don't cope with utf8 well sub to_utf8($) { my ($str) = @_; utf8::decode($str) unless utf8::is_utf8($str); return $str; } sub readlink_utf8($) { my ($filename) = @_; return to_utf8(readlink($filename)); } sub realpath($) { return to_utf8(Cwd::realpath(@_)); } sub bsd_glob($) { return map {to_utf8($_)} File::Glob::bsd_glob(@_); } |