似乎每隔一陣子就會遇到,參考 http://perldoc.perl.org/utf8.html
use utf8;
no utf8;
# Convert the internal representation of a Perl scalar to/from UTF-8.
$num_octets = utf8::upgrade($string);
$success = utf8::downgrade($string[, FAIL_OK]);
# Change each character of a Perl scalar to/from a series of
# characters that represent the UTF-8 bytes of each original character.
utf8::encode($string); # "\x{100}" becomes "\xc4\x80"
utf8::decode($string); # "\xc4\x80" becomes "\x{100}"
$flag = utf8::is_utf8(STRING); # since Perl 5.8.1
$flag = utf8::valid(STRING);
2011年1月23日 星期日
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言