perlunicook > 5.38.0 との差分

perlunicook 5.38.0 と 5.36.0 の差分

11
22=encoding utf8
33
44=head1 NAME
55
66=begin original
77
88perlunicook - cookbookish examples of handling Unicode in Perl
99
1010=end original
1111
1212perlunicook - Perl で Unicode を扱うためのクックブック風の例
1313
1414=head1 DESCRIPTION
1515
1616=begin original
1717
1818This manpage contains short recipes demonstrating how to handle common Unicode
1919operations in Perl, plus one complete program at the end. Any undeclared
2020variables in individual recipes are assumed to have a previous appropriate
2121value in them.
2222
2323=end original
2424
2525この man ページには、Perl で一般的な Unicode 操作を扱う方法を説明する
2626短いレシピと、最後に一つの完全なプログラムが含まれています。
2727個々のレシピ内の宣言されていない変数は、それ以前に適切な値が
2828設定されていることを仮定しています。
2929
3030=head1 EXAMPLES
3131
3232=head2 ℞ 0: Standard preamble
3333
3434(℞ 0: 標準の前提)
3535
3636=begin original
3737
3838Unless otherwise notes, all examples below require this standard preamble
3939to work correctly, with the C<#!> adjusted to work on your system:
4040
4141=end original
4242
4343特に注記がない限り、以下のすべての例では、この標準の前提が正しく動作し、
4444C<#!> がシステム上で動作するように調整されている必要があります。
4545
4646 #!/usr/bin/env perl
4747
4848=begin original
4949
5050 use v5.36; # or later to get "unicode_strings" feature,
5151 # plus strict, warnings
5252 use utf8; # so literals and identifiers can be in UTF-8
5353 use warnings qw(FATAL utf8); # fatalize encoding glitches
5454 use open qw(:std :encoding(UTF-8)); # undeclared streams in UTF-8
5555 use charnames qw(:full :short); # unneeded in v5.16
5656
5757=end original
5858
5959 use v5.36; # またはそれ以降; "unicode_strings" 機能を有効に
6060 # 加えて strict, warnings
6161 use utf8; # 従ってリテラルと識別子で UTF-8 を使える
6262 use warnings qw(FATAL utf8); # エンコーディングエラーを致命的エラーに
6363 use open qw(:std :encoding(UTF-8)); # 未宣言ストリームを UTF-8 に
6464 use charnames qw(:full :short); # v5.16 では不要
6565
6666=begin original
6767
6868This I<does> make even Unix programmers C<binmode> your binary streams,
6969or open them with C<:raw>, but that's the only way to get at them
7070portably anyway.
7171
7272=end original
7373
7474これは Unix プログラマでさえバイナリストリームを C<binmode> したり、
7575C<:raw> で開いたり I<しています> が、それがとにかくこれらを
7676移植性のあるものにする唯一の方法です。
7777
7878=begin original
7979
8080B<WARNING>: C<use autodie> (pre 2.26) and C<use open> do not get along with each
8181other.
8282
8383=end original
8484
8585B<警告>: C<use autodie>(2.26 より前)と C<use open> は同時に使えません。
8686
8787=head2 ℞ 1: Generic Unicode-savvy filter
8888
8989(℞ 1: 一般的な Unicode が使えるフィルタ)
9090
9191=begin original
9292
9393Always decompose on the way in, then recompose on the way out.
9494
9595=end original
9696
9797常に、入り口で分解し、出口で再合成します。
9898
9999 use Unicode::Normalize;
100100
101101 while (<>) {
102102 $_ = NFD($_); # decompose + reorder canonically
103103 ...
104104 } continue {
105105 print NFC($_); # recompose (where possible) + reorder canonically
106106 }
107107
108108=head2 ℞ 2: Fine-tuning Unicode warnings
109109
110110(℞ 2: Unicode 警告の微調整)
111111
112112=begin original
113113
114114As of v5.14, Perl distinguishes three subclasses of UTF‑8 warnings.
115115
116116=end original
117117
118118v5.14 から、Perl は UTF-8 警告の三つのサブクラスを区別しています。
119119
120120 use v5.14; # subwarnings unavailable any earlier
121121 no warnings "nonchar"; # the 66 forbidden non-characters
122122 no warnings "surrogate"; # UTF-16/CESU-8 nonsense
123123 no warnings "non_unicode"; # for codepoints over 0x10_FFFF
124124
125125=head2 ℞ 3: Declare source in utf8 for identifiers and literals
126126
127127(℞ 3: 識別子とリテラルのためにソースが utf8 であると宣言する)
128128
129129=begin original
130130
131131Without the all-critical C<use utf8> declaration, putting UTF‑8 in your
132132literals and identifiers won’t work right. If you used the standard
133133preamble just given above, this already happened. If you did, you can
134134do things like this:
135135
136136=end original
137137
138138最も重要な C<use utf8> 宣言なしの場合、リテラルと識別子に
139139UTF-8 を入れると正しく動作しません。
140140前述した標準の前提を使った場合、これは既に含まれています。
141141その場合、以下のようなことができます:
142142
143143 use utf8;
144144
145145 my $measure = "Ångström";
146146 my @μsoft = qw( cp852 cp1251 cp1252 );
147147 my @ὑπέρμεγας = qw( ὑπέρ μεγας );
148148 my @鯉 = qw( koi8-f koi8-u koi8-r );
149149 my $motto = "👪 💗 🐪"; # FAMILY, GROWING HEART, DROMEDARY CAMEL
150150
151151=begin original
152152
153153If you forget C<use utf8>, high bytes will be misunderstood as
154154separate characters, and nothing will work right.
155155
156156=end original
157157
158158C<use utf8> を忘れると、上位バイトは別々の文字として誤解され、
159159何も正しく動作しません。
160160
161161=head2 ℞ 4: Characters and their numbers
162162
163163(℞ 4: 文字とその番号)
164164
165165=begin original
166166
167167The C<ord> and C<chr> functions work transparently on all codepoints,
168168not just on ASCII alone — nor in fact, not even just on Unicode alone.
169169
170170=end original
171171
172172C<ord> 関数と C<chr> 関数は、すべての符号位置で透過的に動作します;
173173ASCII だけではなく、実際には Unicode だけでもありません。
174174
175175 # ASCII characters
176176 ord("A")
177177 chr(65)
178178
179179 # characters from the Basic Multilingual Plane
180180 ord("Σ")
181181 chr(0x3A3)
182182
183183 # beyond the BMP
184184 ord("𝑛") # MATHEMATICAL ITALIC SMALL N
185185 chr(0x1D45B)
186186
187187 # beyond Unicode! (up to MAXINT)
188188 ord("\x{20_0000}")
189189 chr(0x20_0000)
190190
191191=head2 ℞ 5: Unicode literals by character number
192192
193193(℞ 5: 文字番号による Unicode リテラル)
194194
195195=begin original
196196
197197In an interpolated literal, whether a double-quoted string or a
198198regex, you may specify a character by its number using the
199199C<\x{I<HHHHHH>}> escape.
200200
201201=end original
202202
203203展開リテラルでは、ダブルクォートで囲まれた文字列か正規表現かにかかわらず、
204204C<\x{I<HHHHHH>}> エスケープを使用して番号で文字を指定できます。
205205
206206 String: "\x{3a3}"
207207 Regex: /\x{3a3}/
208208
209209 String: "\x{1d45b}"
210210 Regex: /\x{1d45b}/
211211
212212 # even non-BMP ranges in regex work fine
213213 /[\x{1D434}-\x{1D467}]/
214214
215215=head2 ℞ 6: Get character name by number
216216
217217(℞ 6: 番号で文字名を取得する)
218218
219219 use charnames ();
220220 my $name = charnames::viacode(0x03A3);
221221
222222=head2 ℞ 7: Get character number by name
223223
224224(℞ 7: 名前で文字番号を取得する)
225225
226226 use charnames ();
227227 my $number = charnames::vianame("GREEK CAPITAL LETTER SIGMA");
228228
229229=head2 ℞ 8: Unicode named characters
230230
231231(℞ 8: Unicode 名による文字)
232232
233233=begin original
234234
235235Use the C<< \N{I<charname>} >> notation to get the character
236236by that name for use in interpolated literals (double-quoted
237237strings and regexes). In v5.16, there is an implicit
238238
239239=end original
240240
241241展開リテラル(ダブルクォートで囲まれた文字列と正規表現)で用いる、
242242名前で文字を得るために C<<\N{I<charname>}>> 表記を使います。
243243v5.16 では、これは暗黙に指定されます:
244244
245245 use charnames qw(:full :short);
246246
247247=begin original
248248
249249But prior to v5.16, you must be explicit about which set of charnames you
250250want. The C<:full> names are the official Unicode character name, alias, or
251251sequence, which all share a namespace.
252252
253253=end original
254254
255255しかし、v5.16 より前のバージョンでは、どの charnames の集合を使用するかを
256256明示的に指定しなければなりません。
257257C<:full> の名前は、Unicode の正式な文字名、別名、または
258258並びであり、すべて名前空間を共有します。
259259
260260 use charnames qw(:full :short latin greek);
261261
262262 "\N{MATHEMATICAL ITALIC SMALL N}" # :full
263263 "\N{GREEK CAPITAL LETTER SIGMA}" # :full
264264
265265=begin original
266266
267267Anything else is a Perl-specific convenience abbreviation. Specify one or
268268more scripts by names if you want short names that are script-specific.
269269
270270=end original
271271
272272それ以外は、Perl 固有の便利な省略形です。
273273用字固有の短い名前が必要な場合は、一つ以上の用字を名前で指定します。
274274
275275 "\N{Greek:Sigma}" # :short
276276 "\N{ae}" # latin
277277 "\N{epsilon}" # greek
278278
279279=begin original
280280
281281The v5.16 release also supports a C<:loose> import for loose matching of
282282character names, which works just like loose matching of property names:
283283that is, it disregards case, whitespace, and underscores:
284284
285285=end original
286286
287287v5.16 リリースでは、文字名の緩やかなマッチングのための
288288C<:loose> インポートにも対応しています;
289289これは特性名の緩やかなマッチングと同じように機能します:
290290つまり、大文字小文字、空白、下線は無視されます:
291291
292292 "\N{euro sign}" # :loose (from v5.16)
293293
294294=begin original
295295
296296Starting in v5.32, you can also use
297297
298298=end original
299299
300300v5.32 から、次のものを使って:
301301
302302 qr/\p{name=euro sign}/
303303
304304=begin original
305305
306306to get official Unicode named characters in regular expressions. Loose
307307matching is always done for these.
308308
309309=end original
310310
311311公式な正規表現での Unicode の名前の文字を得られます。
312312緩いマッチングは常にこれらで行われます。
313313
314314=head2 ℞ 9: Unicode named sequences
315315
316316(℞ 9: Unicode 名による並び)
317317
318318=begin original
319319
320320These look just like character names but return multiple codepoints.
321321Notice the C<%vx> vector-print functionality in C<printf>.
322322
323323=end original
324324
325325これらは文字名のように見えますが、複数の符号位置を返します。
326326C<printf> の C<%vx> ベクトル表示機能に注目してください。
327327
328328 use charnames qw(:full);
329329 my $seq = "\N{LATIN CAPITAL LETTER A WITH MACRON AND GRAVE}";
330330 printf "U+%v04X\n", $seq;
331331 U+0100.0300
332332
333333=head2 ℞ 10: Custom named characters
334334
335335(℞ 10: カスタム名による文字)
336336
337337=begin original
338338
339339Use C<:alias> to give your own lexically scoped nicknames to existing
340340characters, or even to give unnamed private-use characters useful names.
341341
342342=end original
343343
344344C<:alias> を使用して、既存の文字に対してレキシカルスコープの
345345独自のニックネームを付けたり、無名の私用文字に有用な名前を
346346付けることができます。
347347
348348 use charnames ":full", ":alias" => {
349349 ecute => "LATIN SMALL LETTER E WITH ACUTE",
350350 "APPLE LOGO" => 0xF8FF, # private use character
351351 };
352352
353353 "\N{ecute}"
354354 "\N{APPLE LOGO}"
355355
356356=head2 ℞ 11: Names of CJK codepoints
357357
358358(℞ 11: CJK 符号位置の名前)
359359
360360=begin original
361361
362362Sinograms like “東京” come back with character names of
363363C<CJK UNIFIED IDEOGRAPH-6771> and C<CJK UNIFIED IDEOGRAPH-4EAC>,
364364because their “names” vary. The CPAN C<Unicode::Unihan> module
365365has a large database for decoding these (and a whole lot more), provided you
366366know how to understand its output.
367367
368368=end original
369369
370370「東京」のような中国漢字は、「名前」が異なるため、
371371C<CJK UNIFIED IDEOGRAPH-6771> と
372372C<CJK UNIFIED IDEOGRAPH-4EAC> という文字名で戻ってきます。
373373CPAN の C<Unicode::Unihan> モジュールは、その出力を理解する方法を
374374知っていれば、これら(およびさらに多くの)文字をデコードするための
375375大規模なデータベースを持ちます。
376376
377377 # cpan -i Unicode::Unihan
378378 use Unicode::Unihan;
379379 my $str = "東京";
380380 my $unhan = Unicode::Unihan->new;
381381 for my $lang (qw(Mandarin Cantonese Korean JapaneseOn JapaneseKun)) {
382382 printf "CJK $str in %-12s is ", $lang;
383383 say $unhan->$lang($str);
384384 }
385385
386386=begin original
387387
388388prints:
389389
390390=end original
391391
392392これは次のものを表示します:
393393
394394 CJK 東京 in Mandarin is DONG1JING1
395395 CJK 東京 in Cantonese is dung1ging1
396396 CJK 東京 in Korean is TONGKYENG
397397 CJK 東京 in JapaneseOn is TOUKYOU KEI KIN
398398 CJK 東京 in JapaneseKun is HIGASHI AZUMAMIYAKO
399399
400400=begin original
401401
402402If you have a specific romanization scheme in mind,
403403use the specific module:
404404
405405=end original
406406
407407特定のローマ字化スキームを考えている場合は、特定のモジュールを使います:
408408
409409 # cpan -i Lingua::JA::Romanize::Japanese
410410 use Lingua::JA::Romanize::Japanese;
411411 my $k2r = Lingua::JA::Romanize::Japanese->new;
412412 my $str = "東京";
413413 say "Japanese for $str is ", $k2r->chars($str);
414414
415415=begin original
416416
417417prints
418418
419419=end original
420420
421421これは次のものを表示します:
422422
423423 Japanese for 東京 is toukyou
424424
425425=head2 ℞ 12: Explicit encode/decode
426426
427427(℞ 12: 明示的なエンコード/デコード)
428428
429429=begin original
430430
431431On rare occasion, such as a database read, you may be
432432given encoded text you need to decode.
433433
434434=end original
435435
436436まれに、データベースの読み取りなど、デコードする必要がある
437437エンコードされたテキストを受け取ることがあります。
438438
439439 use Encode qw(encode decode);
440440
441441 my $chars = decode("shiftjis", $bytes, 1);
442442 # OR
443443 my $bytes = encode("MIME-Header-ISO_2022_JP", $chars, 1);
444444
445445=begin original
446446
447447For streams all in the same encoding, don't use encode/decode; instead
448448set the file encoding when you open the file or immediately after with
449449C<binmode> as described later below.
450450
451451=end original
452452
453453同じエンコーディングのストリームに対しては、encode/decode を
454454使わないでください;
455455代わりに、後述するように、ファイルを開くとき、またはその直後に
456456C<binmode> でファイルエンコーディングを設定してください。
457457
458458=head2 ℞ 13: Decode program arguments as utf8
459459
460460(℞ 13: プログラム引数を utf8 としてデコードする)
461461
462462 $ perl -CA ...
463463 or
464464 $ export PERL_UNICODE=A
465465 or
466466 use Encode qw(decode);
467467 @ARGV = map { decode('UTF-8', $_, 1) } @ARGV;
468468
469469=head2 ℞ 14: Decode program arguments as locale encoding
470470
471471(℞ 14: プログラム引数をロケールエンコーディングとしてデコードする)
472472
473473 # cpan -i Encode::Locale
474474 use Encode qw(locale);
475475 use Encode::Locale;
476476
477477 # use "locale" as an arg to encode/decode
478478 @ARGV = map { decode(locale => $_, 1) } @ARGV;
479479
480480=head2 ℞ 15: Declare STD{IN,OUT,ERR} to be utf8
481481
482482(℞ 15: STD{IN,OUT,ERR} を utf8 として宣言する)
483483
484484=begin original
485485
486486Use a command-line option, an environment variable, or else
487487call C<binmode> explicitly:
488488
489489=end original
490490
491491コマンドラインオプションや環境変数を使うか、明示的に
492492C<binmode> を呼び出します。
493493
494494 $ perl -CS ...
495495 or
496496 $ export PERL_UNICODE=S
497497 or
498498 use open qw(:std :encoding(UTF-8));
499499 or
500500 binmode(STDIN, ":encoding(UTF-8)");
501501 binmode(STDOUT, ":utf8");
502502 binmode(STDERR, ":utf8");
503503
504504=head2 ℞ 16: Declare STD{IN,OUT,ERR} to be in locale encoding
505505
506506(℞ 15: STD{IN,OUT,ERR} をロケールエンコーディングとして宣言する)
507507
508508 # cpan -i Encode::Locale
509509 use Encode;
510510 use Encode::Locale;
511511
512512 # or as a stream for binmode or open
513513 binmode STDIN, ":encoding(console_in)" if -t STDIN;
514514 binmode STDOUT, ":encoding(console_out)" if -t STDOUT;
515515 binmode STDERR, ":encoding(console_out)" if -t STDERR;
516516
517517=head2 ℞ 17: Make file I/O default to utf8
518518
519519(℞ 17: ファイル I/O のデフォルトを utf8 にする)
520520
521521=begin original
522522
523523Files opened without an encoding argument will be in UTF-8:
524524
525525=end original
526526
527527encoding 引数なしで開かれたファイルは UTF-8 になります:
528528
529529 $ perl -CD ...
530530 or
531531 $ export PERL_UNICODE=D
532532 or
533533 use open qw(:encoding(UTF-8));
534534
535535=head2 ℞ 18: Make all I/O and args default to utf8
536536
537537(℞ 18: 全ての I/O と引数のデフォルトを utf8 にする)
538538
539539 $ perl -CSDA ...
540540 or
541541 $ export PERL_UNICODE=SDA
542542 or
543543 use open qw(:std :encoding(UTF-8));
544544 use Encode qw(decode);
545545 @ARGV = map { decode('UTF-8', $_, 1) } @ARGV;
546546
547547=head2 ℞ 19: Open file with specific encoding
548548
549549(℞ 19: 特定のエンコーディングでファイルを開く)
550550
551551=begin original
552552
553553Specify stream encoding. This is the normal way
554554to deal with encoded text, not by calling low-level
555555functions.
556556
557557=end original
558558
559559ストリームエンコーディングを指定します。
560560これは、低レベル関数を呼び出すのではなく、エンコードされたテキストを
561561処理する通常の方法です。
562562
563563 # input file
564564 open(my $in_file, "< :encoding(UTF-16)", "wintext");
565565 OR
566566 open(my $in_file, "<", "wintext");
567567 binmode($in_file, ":encoding(UTF-16)");
568568 THEN
569569 my $line = <$in_file>;
570570
571571 # output file
572572 open($out_file, "> :encoding(cp1252)", "wintext");
573573 OR
574574 open(my $out_file, ">", "wintext");
575575 binmode($out_file, ":encoding(cp1252)");
576576 THEN
577577 print $out_file "some text\n";
578578
579579=begin original
580580
581581More layers than just the encoding can be specified here. For example,
582582the incantation C<":raw :encoding(UTF-16LE) :crlf"> includes implicit
583583CRLF handling.
584584
585585=end original
586586
587587ここで指定できるのは、エンコーディングだけではありません。
588588例えば、呪文 C<":raw :encoding(UTF-16LE) :crlf"> には
589589暗黙的な CRLF 処理が含まれています。
590590
591591=head2 ℞ 20: Unicode casing
592592
593593(℞ 20: Unicode の大文字小文字)
594594
595595=begin original
596596
597597Unicode casing is very different from ASCII casing.
598598
599599=end original
600600
601601Unicode の大文字小文字は ASCII の大文字小文字とは大きく異なります。
602602
603603 uc("henry ⅷ") # "HENRY Ⅷ"
604604 uc("tschüß") # "TSCHÜSS" notice ß => SS
605605
606606 # both are true:
607607 "tschüß" =~ /TSCHÜSS/i # notice ß => SS
608608 "Σίσυφος" =~ /ΣΊΣΥΦΟΣ/i # notice Σ,σ,ς sameness
609609
610610=head2 ℞ 21: Unicode case-insensitive comparisons
611611
612612(℞ 21: Unicode の大文字小文字を無視した比較)
613613
614614=begin original
615615
616616Also available in the CPAN L<Unicode::CaseFold> module,
617617the new C<fc> “foldcase” function from v5.16 grants
618618access to the same Unicode casefolding as the C</i>
619619pattern modifier has always used:
620620
621621=end original
622622
623623CPAN の L<Unicode::CaseFold> モジュールでも利用可能な、v5.16 の新しい
624624C<fc> "foldcase" 関数は、C</i> パターン修飾子が常に使ってきたのと同じ
625625Unicode 大文字小文字畳み込みへのアクセスを与えます。
626626
627627 use feature "fc"; # fc() function is from v5.16
628628
629629 # sort case-insensitively
630630 my @sorted = sort { fc($a) cmp fc($b) } @list;
631631
632632 # both are true:
633633 fc("tschüß") eq fc("TSCHÜSS")
634634 fc("Σίσυφος") eq fc("ΣΊΣΥΦΟΣ")
635635
636636=head2 ℞ 22: Match Unicode linebreak sequence in regex
637637
638638(℞ 22: 正規表現中の Unicode 改行並びのマッチング)
639639
640640=begin original
641641
642642A Unicode linebreak matches the two-character CRLF
643643grapheme or any of seven vertical whitespace characters.
644644Good for dealing with textfiles coming from different
645645operating systems.
646646
647647=end original
648648
649649Unicode の改行は、2 文字の CRLF 書記素または七つの垂直空白文字の
650650いずれかにマッチングします。
651651異なるオペレーティングシステムから送られてくるテキストファイルを
652652扱うのに適しています。
653653
654654 \R
655655
656656 s/\R/\n/g; # normalize all linebreaks to \n
657657
658658=head2 ℞ 23: Get character category
659659
660660(℞ 23: 文字カテゴリを得る)
661661
662662=begin original
663663
664664Find the general category of a numeric codepoint.
665665
666666=end original
667667
668668数値符号位置の一般カテゴリを見つけます。
669669
670670 use Unicode::UCD qw(charinfo);
671671 my $cat = charinfo(0x3A3)->{category}; # "Lu"
672672
673673=head2 ℞ 24: Disabling Unicode-awareness in builtin charclasses
674674
675675(℞ 24: 組み込み文字クラスで Unicode 判定を無効にする)
676676
677677=begin original
678678
679679Disable C<\w>, C<\b>, C<\s>, C<\d>, and the POSIX
680680classes from working correctly on Unicode either in this
681681scope, or in just one regex.
682682
683683=end original
684684
685685このスコープまたは一つの正規表現で、C<\w>、C<\b>、C<\s>、C<\d>、
686686および POSIX クラスが Unicode で正しく動作しないようにします。
687687
688688 use v5.14;
689689 use re "/a";
690690
691691 # OR
692692
693693 my($num) = $str =~ /(\d+)/a;
694694
695695=begin original
696696
697697Or use specific un-Unicode properties, like C<\p{ahex}>
698698and C<\p{POSIX_Digit>}. Properties still work normally
699699no matter what charset modifiers (C</d /u /l /a /aa>)
700700should be effect.
701701
702702=end original
703703
704704または、C<\p{ahex}> や C<\p{POSIX_Digit>} などの特定の非 Unicode 特性を
705705使います。
706706どの文字集合修飾子 (C</d /u /l /a /aa>) が有効であっても、
707707特性は正常に動作します。
708708
709709=head2 ℞ 25: Match Unicode properties in regex with \p, \P
710710
711711(℞ 25: 正規表現中に \p, \P を使って Unicode 特性にマッチングする)
712712
713713=begin original
714714
715715These all match a single codepoint with the given
716716property. Use C<\P> in place of C<\p> to match
717717one codepoint lacking that property.
718718
719719=end original
720720
721721これらはすべて、指定された特性を持つ一つの符号位置にマッチングします。
722722C<\p> の代わりに C<\P> を使用すると、その特性を持たない一つの符号位置に
723723マッチングします。
724724
725725 \pL, \pN, \pS, \pP, \pM, \pZ, \pC
726726 \p{Sk}, \p{Ps}, \p{Lt}
727727 \p{alpha}, \p{upper}, \p{lower}
728728 \p{Latin}, \p{Greek}
729729 \p{script_extensions=Latin}, \p{scx=Greek}
730730 \p{East_Asian_Width=Wide}, \p{EA=W}
731731 \p{Line_Break=Hyphen}, \p{LB=HY}
732732 \p{Numeric_Value=4}, \p{NV=4}
733733
734734=head2 ℞ 26: Custom character properties
735735
736736(℞ 26: カスタム文字特性)
737737
738738=begin original
739739
740740Define at compile-time your own custom character
741741properties for use in regexes.
742742
743743=end original
744744
745745正規表現で使用する独自のカスタム文字特性をコンパイル時に定義します。
746746
747747 # using private-use characters
748748 sub In_Tengwar { "E000\tE07F\n" }
749749
750750 if (/\p{In_Tengwar}/) { ... }
751751
752752 # blending existing properties
753753 sub Is_GraecoRoman_Title {<<'END_OF_SET'}
754754 +utf8::IsLatin
755755 +utf8::IsGreek
756756 &utf8::IsTitle
757757 END_OF_SET
758758
759759 if (/\p{Is_GraecoRoman_Title}/ { ... }
760760
761761=head2 ℞ 27: Unicode normalization
762762
763763(℞ 27: Unicode 正規化)
764764
765765=begin original
766766
767767Typically render into NFD on input and NFC on output. Using NFKC or NFKD
768768functions improves recall on searches, assuming you've already done to the
769769same text to be searched. Note that this is about much more than just pre-
770770combined compatibility glyphs; it also reorders marks according to their
771771canonical combining classes and weeds out singletons.
772772
773773=end original
774774
775775通常は、入力では NFD に、出力では NFC にレンダリングされます。
776776NFKC または NFKD 関数を使うことで、検索対象の同じテキストに対して
777777既に実行していることを前提として、検索時の再呼び出しが改善されます。
778778これは単に事前結合された互換グリフ以上のものであることに
779779注意してください;
780780正準結合クラスに従ってマークを並び替え、シングルトンを削除します。
781781
782782 use Unicode::Normalize;
783783 my $nfd = NFD($orig);
784784 my $nfc = NFC($orig);
785785 my $nfkd = NFKD($orig);
786786 my $nfkc = NFKC($orig);
787787
788788=head2 ℞ 28: Convert non-ASCII Unicode numerics
789789
790790(℞ 28: 非 ASCII Unicode 数字を変換する)
791791
792792=begin original
793793
794794Unless you’ve used C</a> or C</aa>, C<\d> matches more than
795795ASCII digits only, but Perl’s implicit string-to-number
796796conversion does not current recognize these. Here’s how to
797797convert such strings manually.
798798
799799=end original
800800
801801C</a> や C</aa> を使用していない限り、C<\d> は ASCII 数字以上のものに
802802マッチングしますが、
803803Perl の暗黙的な文字列から数値への変換では、現在のところこれらを
804804認識できません。
805805このような文字列を手動で変換する方法を以下に示します。
806806
807807 use v5.14; # needed for num() function
808808 use Unicode::UCD qw(num);
809809 my $str = "got Ⅻ and ४५६७ and ⅞ and here";
810810 my @nums = ();
811811 while ($str =~ /(\d+|\N)/g) { # not just ASCII!
812812 push @nums, num($1);
813813 }
814814 say "@nums"; # 12 4567 0.875
815815
816816 use charnames qw(:full);
817817 my $nv = num("\N{RUMI DIGIT ONE}\N{RUMI DIGIT TWO}");
818818
819819=head2 ℞ 29: Match Unicode grapheme cluster in regex
820820
821821(℞ 29: 正規表現中の Unicode 書記素クラスタにマッチングする)
822822
823823=begin original
824824
825825Programmer-visible “characters” are codepoints matched by C</./s>,
826826but user-visible “characters” are graphemes matched by C</\X/>.
827827
828828=end original
829829
830830プログラマから見える「文字」は、C</./s> がマッチする符号位置ですが、
831831ユーザから見える「文字」は、C</\X/> がマッチする書記素です。
832832
833833 # Find vowel *plus* any combining diacritics,underlining,etc.
834834 my $nfd = NFD($orig);
835835 $nfd =~ / (?=[aeiou]) \X /xi
836836
837837=head2 ℞ 30: Extract by grapheme instead of by codepoint (regex)
838838
839839(℞ 30: 符号位置によってではなく、書記素によって展開する (正規表現))
840840
841841 # match and grab five first graphemes
842842 my($first_five) = $str =~ /^ ( \X{5} ) /x;
843843
844844=head2 ℞ 31: Extract by grapheme instead of by codepoint (substr)
845845
846846(℞ 31: 符号位置によってではなく、書記素によって展開する (substr))
847847
848848 # cpan -i Unicode::GCString
849849 use Unicode::GCString;
850850 my $gcs = Unicode::GCString->new($str);
851851 my $first_five = $gcs->substr(0, 5);
852852
853853=head2 ℞ 32: Reverse string by grapheme
854854
855855(℞ 32: 文字列を書記素単位で反転する)
856856
857857=begin original
858858
859859Reversing by codepoint messes up diacritics, mistakenly converting
860860C<crème brûlée> into C<éel̂urb em̀erc> instead of into C<eélûrb emèrc>;
861861so reverse by grapheme instead. Both these approaches work
862862right no matter what normalization the string is in:
863863
864864=end original
865865
866866符号位置による反転はダイアクリティカルマークを混乱させ、誤って
867867C<crème brülée> を C<eélûrb emèrc> ではなく
868868C<éel̂urb em̀erc> に変換します;
869869そこで、代わりに書記素による反転を行います。
870870これらの手法はどちらも、文字列の正規化がどのようなものであっても
871871正しく機能します。
872872
873873 $str = join("", reverse $str =~ /\X/g);
874874
875875 # OR: cpan -i Unicode::GCString
876876 use Unicode::GCString;
877877 $str = reverse Unicode::GCString->new($str);
878878
879879=head2 ℞ 33: String length in graphemes
880880
881881(℞ 33: 書記素での文字列長)
882882
883883=begin original
884884
885885The string C<brûlée> has six graphemes but up to eight codepoints.
886886This counts by grapheme, not by codepoint:
887887
888888=end original
889889
890890文字列 C<brülée> は六つの書記素を持ちますが、最大八つの符号位置を持ちます。
891891これは、符号位置ではなく、書記素によってカウントされます:
892892
893893 my $str = "brûlée";
894894 my $count = 0;
895895 while ($str =~ /\X/g) { $count++ }
896896
897897 # OR: cpan -i Unicode::GCString
898898 use Unicode::GCString;
899899 my $gcs = Unicode::GCString->new($str);
900900 my $count = $gcs->length;
901901
902902=head2 ℞ 34: Unicode column-width for printing
903903
904904(℞ 34: 表示のための Unicode 桁幅)
905905
906906=begin original
907907
908908Perl’s C<printf>, C<sprintf>, and C<format> think all
909909codepoints take up 1 print column, but many take 0 or 2.
910910Here to show that normalization makes no difference,
911911we print out both forms:
912912
913913=end original
914914
915915Perl の C<printf>、C<sprintf>、C<format> は、すべての符号位置が
916916一つの表示桁を占有すると考えていますが、多くの符号位置は 0 から 2 を
917917占有します。
918918ここでは、正規化に違いがないことを示すために、両方の形式を出力します。
919919
920920 use Unicode::GCString;
921921 use Unicode::Normalize;
922922
923923 my @words = qw/crème brûlée/;
924924 @words = map { NFC($_), NFD($_) } @words;
925925
926926 for my $str (@words) {
927927 my $gcs = Unicode::GCString->new($str);
928928 my $cols = $gcs->columns;
929929 my $pad = " " x (10 - $cols);
930930 say str, $pad, " |";
931931 }
932932
933933=begin original
934934
935935generates this to show that it pads correctly no matter
936936the normalization:
937937
938938=end original
939939
940940これは、正規化に関係なく正しくパッディングされていることを示すために
941941次のように生成されます。
942942
943943 crème |
944944 crème |
945945 brûlée |
946946 brûlée |
947947
948948=head2 ℞ 35: Unicode collation
949949
950950(℞ 35: Unicode の照合順序)
951951
952952=begin original
953953
954954Text sorted by numeric codepoint follows no reasonable alphabetic order;
955955use the UCA for sorting text.
956956
957957=end original
958958
959959数値符号位置でソートされたテキストは、合理的なアルファベット順ではありません;
960960テキストのソートには UCA を使用してください。
961961
962962 use Unicode::Collate;
963963 my $col = Unicode::Collate->new();
964964 my @list = $col->sort(@old_list);
965965
966966=begin original
967967
968968See the I<ucsort> program from the L<Unicode::Tussle> CPAN module
969969for a convenient command-line interface to this module.
970970
971971=end original
972972
973973このモジュールへの便利なコマンドラインインタフェースについては、
974974L<Unicode::Tassil> CPAN モジュールの I<ucsort> プログラムを参照してください。
975975
976976=head2 ℞ 36: Case- I<and> accent-insensitive Unicode sort
977977
978978(℞ 36: 大文字小文字 I<および> アクセントを無視した Unicode のソート)
979979
980980=begin original
981981
982982Specify a collation strength of level 1 to ignore case and
983983diacritics, only looking at the basic character.
984984
985985=end original
986986
987987照合強度レベル 1 を指定して、大文字小文字とダイアクリティカルマークを
988988無視し、基本文字だけを参照するようにします。
989989
990990 use Unicode::Collate;
991991 my $col = Unicode::Collate->new(level => 1);
992992 my @list = $col->sort(@old_list);
993993
994994=head2 ℞ 37: Unicode locale collation
995995
996996(℞ 37: Unicode ロケールの照合順序)
997997
998998=begin original
999999
10001000Some locales have special sorting rules.
10011001
10021002=end original
10031003
10041004一部のロケールには、特別なソート規則があります。
10051005
10061006 # either use v5.12, OR: cpan -i Unicode::Collate::Locale
10071007 use Unicode::Collate::Locale;
10081008 my $col = Unicode::Collate::Locale->new(locale => "de__phonebook");
10091009 my @list = $col->sort(@old_list);
10101010
10111011=begin original
10121012
10131013The I<ucsort> program mentioned above accepts a C<--locale> parameter.
10141014
10151015=end original
10161016
10171017上記の I<ucsort> プログラムは、C<--locale> パラメータを受け付けます。
10181018
10191019=head2 ℞ 38: Making C<cmp> work on text instead of codepoints
10201020
10211021(℞ 38: 符号位置ではなくテキストでg C<cmp> が動作するようにする)
10221022
10231023=begin original
10241024
10251025Instead of this:
10261026
10271027=end original
10281028
10291029次のようにせずに:
10301030
10311031 @srecs = sort {
10321032 $b->{AGE} <=> $a->{AGE}
10331033 ||
10341034 $a->{NAME} cmp $b->{NAME}
10351035 } @recs;
10361036
10371037=begin original
10381038
10391039Use this:
10401040
10411041=end original
10421042
10431043次を使います:
10441044
10451045 my $coll = Unicode::Collate->new();
10461046 for my $rec (@recs) {
10471047 $rec->{NAME_key} = $coll->getSortKey( $rec->{NAME} );
10481048 }
10491049 @srecs = sort {
10501050 $b->{AGE} <=> $a->{AGE}
10511051 ||
10521052 $a->{NAME_key} cmp $b->{NAME_key}
10531053 } @recs;
10541054
10551055=head2 ℞ 39: Case- I<and> accent-insensitive comparisons
10561056
10571057(℞ 39: 大文字小文字 I<および> アクセントを無視した比較)
10581058
10591059=begin original
10601060
10611061Use a collator object to compare Unicode text by character
10621062instead of by codepoint.
10631063
10641064=end original
10651065
10661066照合オブジェクトを使用して、Unicode テキストを符号位置ではなく
10671067文字で比較します。
10681068
10691069 use Unicode::Collate;
10701070 my $es = Unicode::Collate->new(
10711071 level => 1,
10721072 normalization => undef
10731073 );
10741074
10751075 # now both are true:
10761076 $es->eq("García", "GARCIA" );
10771077 $es->eq("Márquez", "MARQUEZ");
10781078
10791079=head2 ℞ 40: Case- I<and> accent-insensitive locale comparisons
10801080
10811081(℞ 40: 大文字小文字 I<および> アクセントを無視したロケールでの比較)
10821082
10831083=begin original
10841084
10851085Same, but in a specific locale.
10861086
10871087=end original
10881088
10891089同じですが、特定のロケールです。
10901090
10911091 my $de = Unicode::Collate::Locale->new(
10921092 locale => "de__phonebook",
10931093 );
10941094
10951095 # now this is true:
10961096 $de->eq("tschüß", "TSCHUESS"); # notice ü => UE, ß => SS
10971097
10981098=head2 ℞ 41: Unicode linebreaking
10991099
11001100(℞ 41: Unicode の改行)
11011101
11021102=begin original
11031103
11041104Break up text into lines according to Unicode rules.
11051105
11061106=end original
11071107
11081108Unicode 規則に従ってテキストを行に分割します。
11091109
11101110 # cpan -i Unicode::LineBreak
11111111 use Unicode::LineBreak;
11121112 use charnames qw(:full);
11131113
11141114 my $para = "This is a super\N{HYPHEN}long string. " x 20;
11151115 my $fmt = Unicode::LineBreak->new;
11161116 print $fmt->break($para), "\n";
11171117
11181118=head2 ℞ 42: Unicode text in DBM hashes, the tedious way
11191119
11201120(℞ 42: DBM ハッシュの中の Unicode テキスト、退屈な方法)
11211121
11221122=begin original
11231123
11241124Using a regular Perl string as a key or value for a DBM
11251125hash will trigger a wide character exception if any codepoints
11261126won’t fit into a byte. Here’s how to manually manage the translation:
11271127
11281128=end original
11291129
11301130DBM ハッシュのキーまたは値として通常の Perl 文字列を使用すると、
11311131符号位置が 1 バイトに収まらない場合にワイド文字例外が発生します。
11321132次に、手動で変換を管理する方法を示します:
11331133
11341134 use DB_File;
11351135 use Encode qw(encode decode);
11361136 tie %dbhash, "DB_File", "pathname";
11371137
11381138 # STORE
11391139
11401140 # assume $uni_key and $uni_value are abstract Unicode strings
11411141 my $enc_key = encode("UTF-8", $uni_key, 1);
11421142 my $enc_value = encode("UTF-8", $uni_value, 1);
11431143 $dbhash{$enc_key} = $enc_value;
11441144
11451145 # FETCH
11461146
11471147 # assume $uni_key holds a normal Perl string (abstract Unicode)
11481148 my $enc_key = encode("UTF-8", $uni_key, 1);
11491149 my $enc_value = $dbhash{$enc_key};
11501150 my $uni_value = decode("UTF-8", $enc_value, 1);
11511151
11521152=head2 ℞ 43: Unicode text in DBM hashes, the easy way
11531153
11541154(℞ 43: DBM ハッシュの中の Unicode テキスト、簡単な方法)
11551155
11561156=begin original
11571157
11581158Here’s how to implicitly manage the translation; all encoding
11591159and decoding is done automatically, just as with streams that
11601160have a particular encoding attached to them:
11611161
11621162=end original
11631163
11641164次に、変換を暗黙的に管理する方法を示します;
11651165すべてのエンコードとデコードは、特定のエンコーディングが付加された
11661166ストリームと同じように自動的に行われます:
11671167
11681168 use DB_File;
11691169 use DBM_Filter;
11701170
11711171 my $dbobj = tie %dbhash, "DB_File", "pathname";
11721172 $dbobj->Filter_Value("utf8"); # this is the magic bit
11731173
11741174 # STORE
11751175
11761176 # assume $uni_key and $uni_value are abstract Unicode strings
11771177 $dbhash{$uni_key} = $uni_value;
11781178
11791179 # FETCH
11801180
11811181 # $uni_key holds a normal Perl string (abstract Unicode)
11821182 my $uni_value = $dbhash{$uni_key};
11831183
11841184=head2 ℞ 44: PROGRAM: Demo of Unicode collation and printing
11851185
11861186(℞ 44: プログラム: Unicode の照合と表示のデモ)
11871187
11881188=begin original
11891189
11901190Here’s a full program showing how to make use of locale-sensitive
11911191sorting, Unicode casing, and managing print widths when some of the
11921192characters take up zero or two columns, not just one column each time.
11931193When run, the following program produces this nicely aligned output:
11941194
11951195=end original
11961196
11971197以下の完全なプログラムでは、ロケールを認識するソート、
11981198Unicode の大文字小文字、そしていくつかの文字が 1 桁ではなく 0 または 2 桁を
11991199占める場合の印刷幅の管理をどのように利用するかを示しています。
12001200次のプログラムを実行すると、次のようなうまく整列した出力が生成されます:
12011201
12021202 Crème Brûlée....... €2.00
12031203 Éclair............. €1.60
12041204 Fideuà............. €4.20
12051205 Hamburger.......... €6.00
12061206 Jamón Serrano...... €4.45
12071207 Linguiça........... €7.00
12081208 Pâté............... €4.15
12091209 Pears.............. €2.00
12101210 Pêches............. €2.25
12111211 Smørbrød........... €5.75
12121212 Spätzle............ €5.50
12131213 Xoriço............. €3.00
12141214 Γύρος.............. €6.50
12151215 막걸리............. €4.00
12161216 おもち............. €2.65
12171217 お好み焼き......... €8.00
12181218 シュークリーム..... €1.85
12191219 寿司............... €9.99
12201220 包子............... €7.50
12211221
12221222=begin original
12231223
12241224Here's that program.
12251225
12261226=end original
12271227
12281228これがプログラムです。
12291229
12301230 #!/usr/bin/env perl
12311231 # umenu - demo sorting and printing of Unicode food
12321232 #
12331233 # (obligatory and increasingly long preamble)
12341234 #
12351235 use v5.36;
12361236 use utf8;
12371237 use warnings qw(FATAL utf8); # fatalize encoding faults
12381238 use open qw(:std :encoding(UTF-8)); # undeclared streams in UTF-8
12391239 use charnames qw(:full :short); # unneeded in v5.16
12401240
12411241 # std modules
12421242 use Unicode::Normalize; # std perl distro as of v5.8
12431243 use List::Util qw(max); # std perl distro as of v5.10
12441244 use Unicode::Collate::Locale; # std perl distro as of v5.14
12451245
12461246 # cpan modules
12471247 use Unicode::GCString; # from CPAN
12481248
12491249 my %price = (
12501250 "γύρος" => 6.50, # gyros
12511251 "pears" => 2.00, # like um, pears
12521252 "linguiça" => 7.00, # spicy sausage, Portuguese
12531253 "xoriço" => 3.00, # chorizo sausage, Catalan
12541254 "hamburger" => 6.00, # burgermeister meisterburger
12551255 "éclair" => 1.60, # dessert, French
12561256 "smørbrød" => 5.75, # sandwiches, Norwegian
12571257 "spätzle" => 5.50, # Bayerisch noodles, little sparrows
12581258 "包子" => 7.50, # bao1 zi5, steamed pork buns, Mandarin
12591259 "jamón serrano" => 4.45, # country ham, Spanish
12601260 "pêches" => 2.25, # peaches, French
12611261 "シュークリーム" => 1.85, # cream-filled pastry like eclair
12621262 "막걸리" => 4.00, # makgeolli, Korean rice wine
12631263 "寿司" => 9.99, # sushi, Japanese
12641264 "おもち" => 2.65, # omochi, rice cakes, Japanese
12651265 "crème brûlée" => 2.00, # crema catalana
12661266 "fideuà" => 4.20, # more noodles, Valencian
12671267 # (Catalan=fideuada)
12681268 "pâté" => 4.15, # gooseliver paste, French
12691269 "お好み焼き" => 8.00, # okonomiyaki, Japanese
12701270 );
12711271
12721272 my $width = 5 + max map { colwidth($_) } keys %price;
12731273
12741274 # So the Asian stuff comes out in an order that someone
12751275 # who reads those scripts won't freak out over; the
12761276 # CJK stuff will be in JIS X 0208 order that way.
12771277 my $coll = Unicode::Collate::Locale->new(locale => "ja");
12781278
12791279 for my $item ($coll->sort(keys %price)) {
12801280 print pad(entitle($item), $width, ".");
12811281 printf " €%.2f\n", $price{$item};
12821282 }
12831283
12841284 sub pad ($str, $width, $padchar) {
12851285 return $str . ($padchar x ($width - colwidth($str)));
12861286 }
12871287
12881288 sub colwidth ($str) {
12891289 return Unicode::GCString->new($str)->columns;
12901290 }
12911291
12921292 sub entitle ($str) {
12931293 $str =~ s{ (?=\pL)(\S) (\S*) }
12941294 { ucfirst($1) . lc($2) }xge;
12951295 return $str;
12961296 }
12971297
12981298=head1 SEE ALSO
12991299
13001300=begin original
13011301
13021302See these manpages, some of which are CPAN modules:
13031303L<perlunicode>, L<perluniprops>,
13041304L<perlre>, L<perlrecharclass>,
13051305L<perluniintro>, L<perlunitut>, L<perlunifaq>,
13061306L<PerlIO>, L<DB_File>, L<DBM_Filter>, L<DBM_Filter::utf8>,
13071307L<Encode>, L<Encode::Locale>,
13081308L<Unicode::UCD>,
13091309L<Unicode::Normalize>,
13101310L<Unicode::GCString>, L<Unicode::LineBreak>,
13111311L<Unicode::Collate>, L<Unicode::Collate::Locale>,
13121312L<Unicode::Unihan>,
13131313L<Unicode::CaseFold>,
13141314L<Unicode::Tussle>,
13151315L<Lingua::JA::Romanize::Japanese>,
13161316L<Lingua::ZH::Romanize::Pinyin>,
13171317L<Lingua::KO::Romanize::Hangul>.
13181318
13191319=end original
13201320
13211321以下の man ページ; 一部は CPAN モジュールのものです:
13221322L<perlunicode>, L<perluniprops>,
13231323L<perlre>, L<perlrecharclass>,
13241324L<perluniintro>, L<perlunitut>, L<perlunifaq>,
13251325L<PerlIO>, L<DB_File>, L<DBM_Filter>, L<DBM_Filter::utf8>,
13261326L<Encode>, L<Encode::Locale>,
13271327L<Unicode::UCD>,
13281328L<Unicode::Normalize>,
13291329L<Unicode::GCString>, L<Unicode::LineBreak>,
13301330L<Unicode::Collate>, L<Unicode::Collate::Locale>,
13311331L<Unicode::Unihan>,
13321332L<Unicode::CaseFold>,
13331333L<Unicode::Tussle>,
13341334L<Lingua::JA::Romanize::Japanese>,
13351335L<Lingua::ZH::Romanize::Pinyin>,
13361336L<Lingua::KO::Romanize::Hangul>.
13371337
13381338=begin original
13391339
13401340The L<Unicode::Tussle> CPAN module includes many programs
13411341to help with working with Unicode, including
13421342these programs to fully or partly replace standard utilities:
13431343I<tcgrep> instead of I<egrep>,
13441344I<uniquote> instead of I<cat -v> or I<hexdump>,
13451345I<uniwc> instead of I<wc>,
13461346I<unilook> instead of I<look>,
13471347I<unifmt> instead of I<fmt>,
13481348and
13491349I<ucsort> instead of I<sort>.
13501350For exploring Unicode character names and character properties,
13511351see its I<uniprops>, I<unichars>, and I<uninames> programs.
13521352It also supplies these programs, all of which are general filters that do Unicode-y things:
13531353I<unititle> and I<unicaps>;
13541354I<uniwide> and I<uninarrow>;
13551355I<unisupers> and I<unisubs>;
13561356I<nfd>, I<nfc>, I<nfkd>, and I<nfkc>;
13571357and I<uc>, I<lc>, and I<tc>.
13581358
13591359=end original
13601360
13611361L<Unicode::Tussle> CPAN モジュールには、Unicode を扱うための多くの
13621362プログラムが含まれています;
13631363これらのプログラムは、標準ユーティリティを完全にまたは部分的に
13641364置き換えるためのものです:
13651365I<egrep> の代わりに I<tcgrep>、
13661366I<cat -v> または I<hexdump> の代わりに I<uniquote>、
13671367I<wc> の代わりに I<uniwc>、
13681368I<look> の代わりに I<unilook>、
13691369I<fmt> の代わりに I<unifmt>、
13701370I<sort> の代わりに I<ucsort>。
13711371Unicode 文字名と文字特性を調べるには、I<uniprops>、I<unichars>、
13721372I<uninames> プログラムを参照してください。
13731373また、これらのプログラムも提供しています。
13741374これらはすべて Unicode 対応の一般的なフィルタです:
13751375I<unititle> と I<unicaps>、
13761376I<uniwide> と I<uninarrow>、
13771377I<unisupers> と I<unisubs>、
13781378I<nfd>、I<nfc>、I<nfkd>、I<nfkc>;
13791379I<uc>、I<lc>、I<tc>。
13801380
13811381=begin original
13821382
13831383Finally, see the published Unicode Standard (page numbers are from version
138413846.0.0), including these specific annexes and technical reports:
13851385
13861386=end original
13871387
13881388最後に、これらの特定の付属文書および技術報告書を含む、公開された
13891389Unicode 標準(ページ番号はバージョン6.0.0 から) を参照してください。
13901390
13911391=over
13921392
13931393=item §3.13 Default Case Algorithms, page 113;
13941394§4.2 Case, pages 120–122;
13951395Case Mappings, page 166–172, especially Caseless Matching starting on page 170.
13961396
13971397=item UAX #44: Unicode Character Database
13981398
13991399=item UTS #18: Unicode Regular Expressions
14001400
14011401=item UAX #15: Unicode Normalization Forms
14021402
14031403=item UTS #10: Unicode Collation Algorithm
14041404
14051405=item UAX #29: Unicode Text Segmentation
14061406
14071407=item UAX #14: Unicode Line Breaking Algorithm
14081408
14091409=item UAX #11: East Asian Width
14101410
14111411=back
14121412
14131413=head1 AUTHOR
14141414
14151415=begin original
14161416
14171417Tom Christiansen E<lt>tchrist@perl.comE<gt> wrote this, with occasional
14181418kibbitzing from Larry Wall and Jeffrey Friedl in the background.
14191419
14201420=end original
14211421
14221422Tom Christiansen E<lt>tchrist@perl.comE<gt> が、
14231423時々 Larry Wall と Jeffrey Friedl に後ろから口出しされながら書きました。
14241424
14251425=head1 COPYRIGHT AND LICENCE
14261426
14271427Copyright © 2012 Tom Christiansen.
14281428
14291429This program is free software; you may redistribute it and/or modify it
14301430under the same terms as Perl itself.
14311431
14321432=begin original
14331433
14341434Most of these examples taken from the current edition of the “Camel Book”;
14351435that is, from the 4ᵗʰ Edition of I<Programming Perl>, Copyright © 2012 Tom
14361436Christiansen <et al.>, 2012-02-13 by O’Reilly Media. The code itself is
14371437freely redistributable, and you are encouraged to transplant, fold,
14381438spindle, and mutilate any of the examples in this manpage however you please
14391439for inclusion into your own programs without any encumbrance whatsoever.
14401440Acknowledgement via code comment is polite but not required.
14411441
14421442=end original
14431443
14441444これらの例のほとんどは、"Camel Book"の現在の版から引用されています:
14451445すなわち、4ᵗʰ版I<Programming Perl>, Copyright © 2012 Tom
14461446Christiansen <et al.>, 2012-02-13 by O'Reilly Media。
14471447コード自体は自由に再配布可能であり、この man ページの例を移植したり、
14481448折りたたんだり、紡錘形にしたり、切断したりすることが推奨されますが、
14491449あなた自身のプログラムに含めるためには、何も気にせずに行ってください。
14501450コードコメントによる謝辞は丁寧ですが、必須ではありません。
14511451
14521452=head1 REVISION HISTORY
14531453
14541454=begin original
14551455
14561456v1.0.0 – first public release, 2012-02-27
14571457
14581458=end original
14591459
14601460v1.0.0 - 最初の一般公開、2012-02-27
14611461
14621462=begin meta
14631463
14641464Translate: SHIRAKATA Kentaro <argrath@ub32.org>
14651465Status: completed
14661466
14671467=end meta