看来不少人已经在使用perl 5.10了呀。
cnhack TNT wrote:
> utf8 flag on 的意思是,这个字符串将被作为一个个的 unicode 字符来对待,
> utf8 flag off 的意思是,这个字符串对 perl 来说无语义,只是一堆字节流,
> perl 对它的操作会是针对字节的。
> \x{4567} 的形式是 unicode 字符的形式,所以它对 perl 来说是具有语义的一
> 个字符,untf8 flag 默认是 on。
> 像 substr 这种函数,也是根据 utf8 flag 来决定怎么样对字符操作(on 就是
> 按字符,off 就是按字节)。
>
> 可参看:
> http://search.cpan.org/~dapm/perl-5.10.1/pod/perlunicode.pod
> <http://search.cpan.org/%7Edapm/perl-5.10.1/pod/perlunicode.pod>
> http://search.cpan.org/~dapm/perl-5.10.1/pod/perluniintro.pod
> <http://search.cpan.org/%7Edapm/perl-5.10.1/pod/perluniintro.pod>
>
> 2009/8/23 point <[email protected] <mailto:[email protected]>>
>
> use Encode;
> my $str='\x{4567}";
> print "utf8 flag on" if Encode::is_utf8($str);
>
> 将打印 "utf8 flag on"
>
> 为什么这种形式的字符串默认打开了 utf8 flag ?
>
>
> Perl的内部存储格式为utf8,这点的\x{4567}为unicode码,是不是遇到这种
> 格式的字符串就默认已经转换为了utf8格式,并打开了
> utf8 flag ?
>
>
>
>
--
Perl乐事 -- http://www.perlersh.org
我的博客 -- http://www.perlersh.org/blog.html
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛“PerlChina Mongers 讨论组”论坛。
要在此论坛发帖,请发电子邮件到 [email protected]
要退订此论坛,请发邮件至 [email protected]
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---