utf8 Perl编译 来启用/禁用 UTF-8(or UTF-EBCDIC) 在源代码里
简洁:
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}"
# Convert a code point from the platform native character set to
# Unicode, and vice-versa.
$unicode = utf8::native_to_unicode(ord('A')); # returns 65 on both
# ASCII and EBCDIC
# platforms
$native = utf8::unicode_to_native(65); # returns 65 on ASCII
# platforms; 193 on
perl use utf8
最新推荐文章于 2019-11-05 09:00:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)