410. Unicode in Perl


番号順一覧Top スレッド順一覧Top
作者: Bruce.
日時: 2004/7/09(19:16)
Bruce. です。

今日、Perl(ActivePerl 5.8.4 Build 810)をいじっていて気がついたこと。

C:\home\work>echo 漢字|perl -Mencoding=sjis -ne "print if /\p{InBasicLatin}+/"
漢字

C:\home\work>echo 漢字|perl -ne "print if /\p{InBasicLatin}+/"


・・・え? いくらなんでも漢字がBasciLatinというのは無理があるのではなかろうか。
unicore/Blocks.pl によると

return <<'END';
0000	007F	Basic Latin
0080	00FF	Latin-1 Supplement
0100	017F	Latin Extended-A
0180	024F	Latin Extended-B
(略)
END

だし。

もっと引っかかったのは

C:\home\work>echo 漢字|perl -Mencoding=sjis -ne "print if /[[:ascii:]]+/"
漢字

C:\home\work>echo 漢字|perl -ne "print if /[[:ascii:]]+/"
漢字

C:\home\work>echo 漢字|perl -Mencoding=sjis -ne "print if /[[:alnum:]]+/"
漢字

C:\home\work>echo 漢字|perl -ne "print if /[[:alnum:]]+/"

何じゃこの結果は・・・


-- 
木村浩一
  I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
  mail kbk@...
  web  www.kt.rim.or.jp/~kbk/
前の発言: 409. 日本でも ...(Re: Perl5.8.1では、 ShiftJISの 2 バイト目に含まれる \x5Cの問題は解決されている) [Yさ] 2004/7/9(09:40)
後の発言: 411. Re: Unicode in Perl [藤岡和夫] 2004/7/09(21:18)
親発言:
子発言: 411. Re: Unicode in Perl [藤岡和夫] 2004/7/09(21:18)
        413. Re: Unicode in Perl [Bruce.] 2004/7/10(02:04)