=encoding euc-jp =head1 NAME =begin original perlunicode - Unicode support in Perl =end original perlunicode - Perl における Unicode サポート =head1 DESCRIPTION =head2 Important Caveats (重要な警告) =begin original Unicode support is an extensive requirement. While Perl does not implement the Unicode standard or the accompanying technical reports from cover to cover, Perl does support many Unicode features. =end original Unicode サポートは大規模な要求です。 Perl は標準 Unicode や付随する技術的なレポートを一つ残らず 実装しているわけではありませんが、多くの Unicode 機能を サポートしています。 =begin original People who want to learn to use Unicode in Perl, should probably read the L and L, before reading this reference document. =end original Perl で Unicode を使うことを学びたい人は、多分このリファレンスを読む前に L と L を 読んだ方がよいでしょう。 =begin original Also, the use of Unicode may present security issues that aren't obvious. Read L. =end original また、Unicode を使うと、明らかではないセキュリティ問題が姿を現すかも 知れません。 L を 読んでください。 =over 4 =item Safest if you C (C とすれば一番安全) =begin original In order to preserve backward compatibility, Perl does not turn on full internal Unicode support unless the pragma C is specified. (This is automatically selected if you use C or higher.) Failure to do this can trigger unexpected surprises. See L below. =end original 後方互換性を維持するために、Perl は C プラグマが指定されない限り 完全な内部 Unicode 対応をオンにしません。 (これは C 以上を使うと自動的に選択されます。) こうするのに失敗すると予測できない驚きを引き起こすかも知れません。 後述する L を参照してください。 =begin original This pragma doesn't affect I/O. Nor does it change the internal representation of strings, only their interpretation. There are still several places where Unicode isn't fully supported, such as in filenames. =end original このプラグマは I/O には影響しません。 また、文字列の内部表現も変更しません; その解釈だけです。 ファイル名のように Unicode に完全に対応していない場所がいくつかあります。 =item Input and Output Layers (入出力層) =begin original Perl knows when a filehandle uses Perl's internal Unicode encodings (UTF-8, or UTF-EBCDIC if in EBCDIC) if the filehandle is opened with the C<:encoding(utf8)> layer. Other encodings can be converted to Perl's encoding on input or from Perl's encoding on output by use of the C<:encoding(...)> layer. See L. =end original Perl は、ファイルハンドルが C<:encoding(utf8)> 層を指定してオープンされると、 ファイルハンドルが Perl の内部 Unicode エンコーディング (UTF-8, または EBCDIC の時は UTF-EBCDIC) を使うことが分かります。 その他のエンコーディングは、C<:encoding(...)> 層を使うことで、 入力時の Perl のエンコーディングへの変換や出力時の Perl の エンコーディングからの変換を行えます。 L を参照してください。 =begin original To indicate that Perl source itself is in UTF-8, use C. =end original Perl のソース自身が UTF-8 であることを示すには、C を 使ってください。 =item C still needed to enable UTF-8/UTF-EBCDIC in scripts =begin original As a compatibility measure, the C pragma must be explicitly included to enable recognition of UTF-8 in the Perl scripts themselves (in string or regular expression literals, or in identifier names) on ASCII-based machines or to recognize UTF-EBCDIC on EBCDIC-based machines. B is needed.> See L. =end original 互換性のために、ASCII ベースのマシンにおいて Perl スクリプトそれ自身の 中の UTF-8 を(文字列や正規表現リテラル、あるいは変数名で) 認識可能に するためや、EBCDIC ベースのマシンで UTF-EBCDIC を認識させるために C プラグマを明示的に含めなければなりません。 B<これらは明示的に C が必要な唯一の場合です。> L を参照してください。 =item C-marked scripts and UTF-16 scripts autodetected =begin original If a Perl script begins marked with the Unicode C (UTF-16LE, UTF16-BE, or UTF-8), or if the script looks like non-C-marked UTF-16 of either endianness, Perl will correctly read in the script as Unicode. (Cless UTF-8 cannot be effectively recognized or differentiated from ISO 8859-1 or other eight-bit encodings.) =end original Unicode C (UTF-16LE, UTF16-BE, またはUTF-8)で Perl スクリプトが 始まっていたり、スクリプトが C がついていない UTF-16(BE か LE のいずれか) であった場合、Perl はそのスクリプトを Unicode であるとして正しく読み込みます。 (C がない UTF-8 は、効率的に ISO 8859-1 などの 8 ビットエンコーディングと 区別したり認識することができません。) =item C needed to upgrade non-Latin-1 byte strings =begin original By default, there is a fundamental asymmetry in Perl's Unicode model: implicit upgrading from byte strings to Unicode strings assumes that they were encoded in I, but Unicode strings are downgraded with UTF-8 encoding. This happens because the first 256 codepoints in Unicode happens to agree with Latin-1. =end original デフォルトでは、Perl の Unicode モデルにおける基本的な非対称があります: バイト文字列から Unicode 文字列への暗黙の昇格はその文字列が I でエンコードされているものと仮定しますが、 Unicode 文字列からのダウングレードは UTF-8 エンコーディングへと行われます。 これは Unicode の最初の 256 文字が Latin-1 と共通であるからです。 =begin original See L for more details. =end original 詳細は L を参照してください。 =back =head2 Byte and Character Semantics (バイトと文字のセマンティクス) =begin original Perl uses logically-wide characters to represent strings internally. =end original Perl は論理的なワイド文字を内部的な文字列の表現のために使っています。 =begin original Starting in Perl 5.14, Perl-level operations work with characters rather than bytes within the scope of a C> (or equivalently C or higher). (This is not true if bytes have been explicitly requested by C>, nor necessarily true for interactions with the platform's operating system.) =end original Perl 5.14 から、C> (または等価な C 以上) のスコープ内では、 Perl レベルの操作はバイトではなく文字に対して働きます。 (これは C> によってバイトが明示的に要求された 場合には真ではなく、プラットフォームのオペレーティングシステムとの 相互作用に関しては真である必要はありません。) =begin original For earlier Perls, and when C is not in effect, Perl provides a fairly safe environment that can handle both types of semantics in programs. For operations where Perl can unambiguously decide that the input data are characters, Perl switches to character semantics. For operations where this determination cannot be made without additional information from the user, Perl decides in favor of compatibility and chooses to use byte semantics. =end original より古い Perl や、C が有効でないとき、Perl は プログラムで両方の型の意味論を扱えるかなり安全な環境を提供します。 入力データが文字であると Perl が曖昧さなく決定できる操作については、 Perl は文字セマンティクスに切り替えます。 ユーザーからの付加的な情報抜きに決定することができない操作については Perl は互換性の観点からバイトセマンティクスを選択します。 =begin original When C (but not C) is in effect, Perl uses the rules associated with the current locale. (C overrides C in the same scope; while C effectively also selects C in its scope; see L.) Otherwise, Perl uses the platform's native byte semantics for characters whose code points are less than 256, and Unicode rules for those greater than 255. That means that non-ASCII characters are undefined except for their ordinal numbers. This means that none have case (upper and lower), nor are any a member of character classes, like C<[:alpha:]> or C<\w>. (But all do belong to the C<\W> class or the Perl regular expression extension C<[:^alpha:]>.) =end original C が有効 (しかし C が有効でない) の場合、Perl は現在のロケールに関連づけられた規則を使います。 (C は同じスコープ内の C を 上書きします; 一方 C も事実上そのスコープ内で C を選択します; L を 参照してください。) さもなければ、Perl は 256 より小さい符号位置の文字に関しては プラットフォームのネイティブなバイト意味論を使い、 255 より大きい符号位置については Unicode の規則を使います。 つまり 非 ASCII 文字は、その番号以外では未定義です。 つまり、大文字小文字はなく、C<[:alpha:]> や C<\w> のような、 どの文字クラスにも含まれません。 (しかし C<\W> クラスや Perl の正規表現拡張 C<[:^alpha:]> には属します。) =begin original This behavior preserves compatibility with earlier versions of Perl, which allowed byte semantics in Perl operations only if none of the program's inputs were marked as being a source of Unicode character data. Such data may come from filehandles, from calls to external programs, from information provided by the system (such as C<%ENV>), or from literals and constants in the source text. =end original この動作は Perl の以前のバージョンとの互換性を維持し、プログラムの 入力が Unicode の文字データのソースであるとマークされていない場合にのみ Perl の操作でバイトセマンティクスを許可します。 そのようなデータは、ファイルハンドル、外部プログラムの呼び出し、 システムから提供される情報(C<%ENV> のような)、ソーステキスト中のリテラルや 定数といったものからくるものです。 =begin original The C pragma is primarily a compatibility device that enables recognition of UTF-(8|EBCDIC) in literals encountered by the parser. Note that this pragma is only required while Perl defaults to byte semantics; when character semantics become the default, this pragma may become a no-op. See L. =end original C プラグマは主としてパーサが遭遇するリテラル中の UTF-(8|EBCDIC) の 認識を有効にする互換デバイス(compatibility device)です。 このプラグマは Perl のデフォルトがバイトセマンティクスであるときにのみ 必要であることに注意してください; 文字セマンティクスが デフォルトである場合には、このプラグマは何もしません。 L を参照してください。 =begin original If strings operating under byte semantics and strings with Unicode character data are concatenated, the new string will have character semantics. This can cause surprises: See L, below. You can choose to be warned when this happens. See C>. =end original バイトセマンティクスの元での文字列の操作で、Unicode 文字データが 連結された文字列であった場合、新たな文字列は文字セマンティックスを 保ちます。 これは驚きを引き起こすかもしれません: 後述する L を 参照してください。 これが起きたときに警告されるようにすることを選択できます。 C> を参照してください。 =begin original Under character semantics, many operations that formerly operated on bytes now operate on characters. A character in Perl is logically just a number ranging from 0 to 2**31 or so. Larger characters may encode into longer sequences of bytes internally, but this internal detail is mostly hidden for Perl code. See L for more. =end original 文字セマンティクスの元では、伝統的にバイトに対して働いていた操作の多くが 文字に対して働きます。 Perl における文字は論理的には 0 から 2**31 までの範囲の数値です。 大きな文字は内部的にはより長いシーケンスにエンコードされる可能性が ありますが、この内部の詳細は Perl プログラムからほとんど隠されています。 詳細は L を参照してください。 =head2 Effects of Character Semantics (文字セマンティクスの効果) =begin original Character semantics have the following effects: =end original 文字セマンティクスは以下の効果を持っています: =over 4 =item * =begin original Strings--including hash keys--and regular expression patterns may contain characters that have an ordinal value larger than 255. =end original 文字列 -- ハッシュのキーを含め -- と正規表現パターンは序数値として 255 を 超える値を持つ文字を含めることができます。 =begin original If you use a Unicode editor to edit your program, Unicode characters may occur directly within the literal strings in UTF-8 encoding, or UTF-16. (The former requires a C or C, the latter requires a C.) =end original プログラムを編集するのに Unicode エディタを使っているのであれば、Unicode の 文字 UTF-8 か UTF-16 のエンコーディングコーディングでリテラル文字列に 含めることができます。 (前者は C か C を必要とし、後者は C を必要とします。) =begin original Unicode characters can also be added to a string by using the C<\N{U+...}> notation. The Unicode code for the desired character, in hexadecimal, should be placed in the braces, after the C. For instance, a smiley face is C<\N{U+263A}>. =end original Unicode の文字は C<\x{...}> 表記を使うことにより文字列に 追加することもできます。 その表現される Unicode コードは、16 進でブレースに囲みます。 たとえば、smiley face は C<\N{U+263A}> です。 =begin original Alternatively, you can use the C<\x{...}> notation for characters C<0x100> and above. For characters below C<0x100> you may get byte semantics instead of character semantics; see L. On EBCDIC machines there is the additional problem that the value for such characters gives the EBCDIC character rather than the Unicode one, thus it is more portable to use C<\N{U+...}> instead. =end original あるいは、C<0x100> 以上の文字については C<\x{...}> 記法が使えます。 C<0x100> より小さい文字については文字セマンティクスではなく バイトセマンティクスを使います; L を参照してください。 EBCDIC マシンでは、このような文字の値が Unicode のものではなく EBCDIC のものになるという追加の問題があります; 従って、代わりに C<\N{U+...}> を使う方が移植性があります。 =begin original Additionally, you can use the C<\N{...}> notation and put the official Unicode character name within the braces, such as C<\N{WHITE SMILING FACE}>. This automatically loads the L module with the C<:full> and C<:short> options. If you prefer different options for this module, you can instead, before the C<\N{...}>, explicitly load it with your desired options; for example, =end original これに加えて、C<\N{...}> 表記を使うことができ、公式な Unicode 文字名を C<\N{WHITE SMILING FACE}> のようにブレースの中に置くことができます。 これは自動的に C<:full> と C<:short> オプション付きで L で読み込みます。 このモジュールに異なったオプションを指定したい場合は、C<\N{...}> を 使う前に、好みのオプションで明示的にこれを読み込んでください; 例えば: use charnames ':loose'; =item * =begin original If an appropriate L is specified, identifiers within the Perl script may contain Unicode alphanumeric characters, including ideographs. Perl does not currently attempt to canonicalize variable names. =end original 適切な L が指定されていれば、Perl スクリプトの中の識別子で 表意文字を含めた Unicode の英数字を含めることができます。 Perl は現在、変数名を正規化しようとはしません。 =item * =begin original Regular expressions match characters instead of bytes. C<"."> matches a character instead of a byte. =end original 正規表現はバイトではなく文字にマッチします。 C<"."> は一バイトではなく、ひとつの文字にマッチします。 =item * =begin original Bracketed character classes in regular expressions match characters instead of bytes and match against the character properties specified in the Unicode properties database. C<\w> can be used to match a Japanese ideograph, for instance. =end original 正規表現中の大かっこ文字クラスはバイトではなく文字にマッチし、Unicode の 特性データベースで定義されている文字特性に対してマッチを行います。 たとえば、C<\w> は日本語の表意文字にマッチさせるために使うことができます。 =item * =begin original Named Unicode properties, scripts, and block ranges may be used (like bracketed character classes) by using the C<\p{}> "matches property" construct and the C<\P{}> negation, "doesn't match property". See L for more details. =end original 名前付き Unicode 特性、用字、ブロック範囲は、 C<\p{}> 「特性にマッチング」構文および否定である C<\P{}> 「特性にマッチングしない」を使って(大かっこ文字クラスのように)使えます。 さらなる詳細については L を参照してください。 =begin original You can define your own character properties and use them in the regular expression with the C<\p{}> or C<\P{}> construct. See L for more details. =end original 独自の文字特性を定義して、C<\p{}> と C<\P{}> 構文によって 正規表現でそれらを使うことができます。 さらなる詳細については L を 参照してください。 =item * =begin original The special pattern C<\X> matches a logical character, an "extended grapheme cluster" in Standardese. In Unicode what appears to the user to be a single character, for example an accented C, may in fact be composed of a sequence of characters, in this case a C followed by an accent character. C<\X> will match the entire sequence. =end original 特殊なパターン C<\X> は論理文字、標準で言うところの 「拡張書記素クラスタ」にマッチングします。 Unicode では、ユーザーには単一の文字、例えばアクセント付きの C に 見えるものが、実際には文字の並び、この場合では C に引き続いて アクセント文字から構成されるかもしれません。 C<\X> は並び全体にマッチングします。 =item * =begin original The C operator translates characters instead of bytes. Note that the C functionality has been removed. For similar functionality see pack('U0', ...) and pack('C0', ...). =end original C 演算子はバイトではなく文字で変換します。 C は削除されたことに注意してください。 同様のことを行うには pack('U0', ...) と pack('C0', ...) を 参照してください。 =item * =begin original Case translation operators use the Unicode case translation tables when character input is provided. Note that C, or C<\U> in interpolated strings, translates to uppercase, while C, or C<\u> in interpolated strings, translates to titlecase in languages that make the distinction (which is equivalent to uppercase in languages without the distinction). =end original 大小文字の変換演算子は Unicode の大小文字変換テーブルを、文字の入力が あったときに使用します。 C や展開文字列中の C<\U> は大文字に変換し、C や 展開文字列中の C<\u> はその言語で区別されているときに タイトルケースに変換します (これは、区別がない言語では大文字と等価です)。 =item * =begin original Most operators that deal with positions or lengths in a string will automatically switch to using character positions, including C, C, C, C, C, C, C, C, and C. An operator that specifically does not switch is C. Operators that really don't care include operators that treat strings as a bucket of bits such as C, and operators dealing with filenames. =end original 文字列の位置や長さを取り扱う演算子の大部分は自動的に文字の位置を 使うように変更されました; これには C, C, C, C, C, C, C, C, C が 含まれます。 C は変更されていません。 文字列をビットのバケツのように扱う C、ファイル名を取り扱う演算子は 文字かどうかを気にしません。 =item * =begin original The C/C letter C does I change, since it is often used for byte-oriented formats. Again, think C in the C language. =end original C/C の文字 C は I<変更されていません>; なぜなら、 これらはしばしばバイト指向の書式のために使われるからです。 繰り返しますが、C 言語の C を考えてください。 =begin original There is a new C specifier that converts between Unicode characters and code points. There is also a C specifier that is the equivalent of C/C and properly handles character values even if they are above 255. =end original Unicode の文字と符号位置の間の変換を行う新たな C 指定子があります。 C/C と等価で、文字の値が 255 を超えていても適切に扱える C 指定子もあります。 =item * =begin original The C and C functions work on characters, similar to C and C, I C and C. C and C are methods for emulating byte-oriented C and C on Unicode strings. While these methods reveal the internal encoding of Unicode strings, that is not something one normally needs to care about at all. =end original C 関数と C 関数は C や C のように 文字に対して働き、C や C のようには I<働きません>。 C と C は Unicode 文字列においてバイト指向の C や C をエミュレートするためのメソッドです。 これらのメソッドが Unicode 文字列の内部エンコーディングを明らかにするので、 通常はケアする必要はありません。 =item * =begin original The bit string operators, C<& | ^ ~>, can operate on character data. However, for backward compatibility, such as when using bit string operations when characters are all less than 256 in ordinal value, one should not use C<~> (the bit complement) with characters of both values less than 256 and values greater than 256. Most importantly, DeMorgan's laws (C<~($x|$y) eq ~$x&~$y> and C<~($x&$y) eq ~$x|~$y>) will not hold. The reason for this mathematical I is that the complement cannot return B the 8-bit (byte-wide) bit complement B the full character-wide bit complement. =end original ビット文字列演算子 C<& | ^ ~> は文字データを操作できます。 しかし、例えば全ての文字の値が 255 以下のときに ビット文字列演算を使った場合の後方互換性のために、 256 以上の値の文字と 255 以下の値の文字の両方が含まれている文字列に C<~> (ビット補数) を使うべきではありません。 最も重要なことは、ド・モルガンの法則 (C<~($x|$y) eq ~$x&~$y> と C<~($x&$y) eq ~$x|~$y>) が成り立たないということです。 この数学的な I<過失> の理由は補数(complement)が 8 ビットのビット補数 B<および> 文字幅のビット補数の B<両方> を返すことができないためです。 =item * =begin original There is a CPAN module, C>, which allows you to define your own mappings to be used in C, C, C, C, and C (or their double-quoted string inlined versions such as C<\U>). (Prior to Perl 5.16, this functionality was partially provided in the Perl core, but suffered from a number of insurmountable drawbacks, so the CPAN module was written instead.) =end original C, C, C, C, C (および C<\U> のような ダブルクォート文字列インライン版) で使える独自のマッピングを定義できる CPAN モジュール C> があります。 (Perl 5.16 以前では、この機能は Perl コアで部分的に提供されていましたが、 多くの克服できない欠点があったため、代わりに CPAN モジュールが書かれました。) =back =over 4 =item * =begin original And finally, C reverses by character rather than by byte. =end original そして最後に、C はバイト単位ではなく文字単位で 反転を行います。 =back =head2 Unicode Character Properties (Unicode 文字特性) =begin original (The only time that Perl considers a sequence of individual code points as a single logical character is in the C<\X> construct, already mentioned above. Therefore "character" in this discussion means a single Unicode code point.) =end original (Perl が個々の符号位置の並びを単一の論理文字として扱う 唯一のタイミングは、既に前述した C<\X> 構文です。 従って、この議論での「文字」は単一の Unicode 符号位置を意味します。) =begin original Very nearly all Unicode character properties are accessible through regular expressions by using the C<\p{}> "matches property" construct and the C<\P{}> "doesn't match property" for its negation. =end original ほぼ全ての Unicode 文字特性は、 C<\p{}> "matches property" 構文とその否定形の C<\P{}> "doesn't match property" を使った正規表現を通してアクセス可能です。 =begin original For instance, C<\p{Uppercase}> matches any single character with the Unicode C<"Uppercase"> property, while C<\p{L}> matches any character with a C of C<"L"> (letter) property (see L below). Brackets are not required for single letter property names, so C<\p{L}> is equivalent to C<\pL>. =end original たとえば、C<\p{Uppercase}> は Unicode の C<"Uppercase"> 特性を持つ任意の 単一の文字にマッチングし、C<\p{L}> は C C<"L"> (letter) 特性を持つ任意の文字にマッチングします (後述する L 参照)。 中かっこは一文字の特性名では省略することができるので、C<\p{L}> は C<\pL> と等価です。 =begin original More formally, C<\p{Uppercase}> matches any single character whose Unicode C property value is C, and C<\P{Uppercase}> matches any character whose C property value is C, and they could have been written as C<\p{Uppercase=True}> and C<\p{Uppercase=False}>, respectively. =end original より正式には、C<\p{Uppercase}> は Unicode の C 特性値 が C である任意の単一の文字とマッチングし、C<\P{UpperCase}> は C 特性値 が C である任意の文字とマッチングします; そしてこれらはそれぞれ C<\p{Uppercase=True}>, C<\p{Uppercase=False}> と書けます。 =begin original This formality is needed when properties are not binary; that is, if they can take on more values than just C and C. For example, the C property (see L below), can take on several different values, such as C, C, C, and others. To match these, one needs to specify both the property name (C), AND the value being matched against (C, C, etc.). This is done, as in the examples above, by having the two components separated by an equal sign (or interchangeably, a colon), like C<\p{Bidi_Class: Left}>. =end original この形式は、特性が 2 値でない場合、つまり、単に C と C より多くの 値を取ることができる場合に必要です。 たとえば、C 特性(L を参照)は、 C, C, C などのさまざまな値を取ることができます。 これらにマッチングするには、特性名(C)と、 マッチングする値 (C, C など) の両方を指定する必要があります。 これは、前述の例のように、二つの要素を等号 (または、C<\p{Biddi_Class:Left}> のように交換可能なコロン)で 区切ることによって、実行されます。 =begin original All Unicode-defined character properties may be written in these compound forms of C<\p{I=I}> or C<\p{I:I}>, but Perl provides some additional properties that are written only in the single form, as well as single-form short-cuts for all binary properties and certain others described below, in which you may omit the property name and the equals or colon separator. =end original すべての Unicode が定義した文字特性は、C<\p{I=I}> や C<\p{I:I}> のような複合形式で書けますが、 Perl は特性名および等号やコロンの区切り文字を省略できるように、 単一形式でのみ書ける追加の特性や、全ての 2 値特性と一部の後述する ものに対する単一形式のショートカットを提供します。 =begin original Most Unicode character properties have at least two synonyms (or aliases if you prefer): a short one that is easier to type and a longer one that is more descriptive and hence easier to understand. Thus the C<"L"> and C<"Letter"> properties above are equivalent and can be used interchangeably. Likewise, C<"Upper"> is a synonym for C<"Uppercase">, and we could have written C<\p{Uppercase}> equivalently as C<\p{Upper}>. Also, there are typically various synonyms for the values the property can be. For binary properties, C<"True"> has 3 synonyms: C<"T">, C<"Yes">, and C<"Y">; and C<"False"> has correspondingly C<"F">, C<"No">, and C<"N">. But be careful. A short form of a value for one property may not mean the same thing as the same short form for another. Thus, for the C> property, C<"L"> means C<"Letter">, but for the L|/Bidirectional Character Types> property, C<"L"> means C<"Left">. A complete list of properties and synonyms is in L. =end original ほとんどの Unicode 文字特性には、少なくとも二つの同義語 (またはあなたが好むなら別名)があります; 簡単に入力できる短いものと、 より長いけれども説明的で理解しやすいものです。 したがって、前述の C<"L"> および C<"Letter"> 特性は等価であり、 交換可能です。 同様に、C<"Upper"> は C<"Uppercase"> の同義語であり、C<\p{Uppercase}> は 等価に C<\p{Upper}> と書けます。 また、典型的には特性の値に対してさまざまな同義語があります。 2 値特性の場合、C<"True"> には三つの同義語があります: C<"T">, C<"Yes">, C<"Y">; C<"False"> には C<"F">, C<"No">, C<"N"> が あります。 しかし注意してください。 ある特性に対する値の短い形式は、他の特性の同じ短い形式と同じものを 意味するとは限りません。 従って、C> 特性では C<"L"> は C<"Letter"> を 意味しますが、L|/Bidirectional Character Types> 特性では、 C<"L"> は C<"Left"> を意味します。 特性および同義語の完全な一覧は L にあります。 =begin original Upper/lower case differences in property names and values are irrelevant; thus C<\p{Upper}> means the same thing as C<\p{upper}> or even C<\p{UpPeR}>. Similarly, you can add or subtract underscores anywhere in the middle of a word, so that these are also equivalent to C<\p{U_p_p_e_r}>. And white space is irrelevant adjacent to non-word characters, such as the braces and the equals or colon separators, so C<\p{ Upper }> and C<\p{ Upper_case : Y }> are equivalent to these as well. In fact, white space and even hyphens can usually be added or deleted anywhere. So even C<\p{ Up-per case = Yes}> is equivalent. All this is called "loose-matching" by Unicode. The few places where stricter matching is used is in the middle of numbers, and in the Perl extension properties that begin or end with an underscore. Stricter matching cares about white space (except adjacent to non-word characters), hyphens, and non-interior underscores. =end original 特性名と値の大文字と小文字の違いは無関係です; したがって C<\p{Upper}> は C<\p{upper}>, さらには C<\p{UpPeR}> とも同じことを 意味します。 同様に、単語の中のどこにでも下線を追加または削除できるので、 これらは C<\p{U_p_p_e_r}> とも等価です。 また、中かっこや等号、コロンなどの非単語文字に隣接した空白は無視されるので、 C<\p{ Upper }> and C<\p{ Upper_case : Y }> も等価です。 実際には、通常、空白とハイフンさえどこにでも追加または削除できます。 したがって、C<\p{Upper case=Yes}> ですらも等価です。 これはすべて Unicode で「緩いマッチング」と呼ばれます。 数少ない厳密なマッチングが採用されている場所は数値の中と、下線で始まったり 終わったりする Perl 拡張特性です。 より厳密なマッチングは空白(非単語文字に隣接するものを除く)、ハイフン、 非内部下線を考慮します。 =begin original You can also use negation in both C<\p{}> and C<\P{}> by introducing a caret (C<^>) between the first brace and the property name: C<\p{^Tamil}> is equal to C<\P{Tamil}>. =end original C<\p{}> と C<\P{}> の両方で、キャレット(C<^>) を最初のブレースと 特性名の間に置くことによって意味を反転することができます: C<\p{^Tamil}> は C<\P{Tamil}> と等価です。 =begin original Almost all properties are immune to case-insensitive matching. That is, adding a C regular expression modifier does not change what they match. There are two sets that are affected. The first set is C, C, and C, all of which match C under C matching. And the second set is C, C, and C, all of which match C under C matching. This set also includes its subsets C and C both of which under C match C. (The difference between these sets is that some things, such as Roman numerals, come in both upper and lower case so they are C, but aren't considered letters, so they aren't Cs.) =end original ほとんど全ての特性は大文字小文字を考慮したマッチングの影響を受けません。 つまり、C 正規表現修飾子を追加することは、 それらがマッチングするものを変えません。 影響を受ける二つの集合があります。 最初の集合は、 C, C, C, C の下で C にマッチングする全てです。 二番目の集合は、 C, C, C, C マッチングの基で C にマッチングする全てです。 この集合はまた、C マッチングの基で C にマッチングする そのサブセット C と C を含みます。 (これらの集合の違いは、ローマ数字のような一部のもので、 大文字と小文字の両方に含まれるので C であるけれども、 しかし字と考えられないので、C ではありません。) =begin original See L for special considerations when matching Unicode properties against non-Unicode code points. =end original 非 Unicode 符号位置に対して Unicode 特性をマッチングしたときの 特殊処理については L を参照してください。 =head3 B =begin original Every Unicode character is assigned a general category, which is the "most usual categorization of a character" (from L). =end original 全ての Unicode 文字は一つの一般カテゴリに割り当てられています; これは「その文字の最も普通のカテゴライズ」 (L より)です。 =begin original The compound way of writing these is like C<\p{General_Category=Number}> (short, C<\p{gc:n}>). But Perl furnishes shortcuts in which everything up through the equal or colon separator is omitted. So you can instead just write C<\pN>. =end original これらを書く複合的な方法は C<\p{General_Category=Number}> (短縮形は C<\p{gc:n}>) のようなものです。 Perl は等号またはコロンの区切り文字までの全てを省略できる機能を 提供しています。 従って、代わりに単に C<\pN> と書けます。 =begin original Here are the short and long forms of the values the C property can have: =end original 以下は、Unicode の C<一般カテゴリ> 特性が持つことができる値の 短形式と長形式です: Short Long L Letter LC, L& Cased_Letter (that is: [\p{Ll}\p{Lu}\p{Lt}]) Lu Uppercase_Letter Ll Lowercase_Letter Lt Titlecase_Letter Lm Modifier_Letter Lo Other_Letter M Mark Mn Nonspacing_Mark Mc Spacing_Mark Me Enclosing_Mark N Number Nd Decimal_Number (also Digit) Nl Letter_Number No Other_Number P Punctuation (also Punct) Pc Connector_Punctuation Pd Dash_Punctuation Ps Open_Punctuation Pe Close_Punctuation Pi Initial_Punctuation (may behave like Ps or Pe depending on usage) Pf Final_Punctuation (may behave like Ps or Pe depending on usage) Po Other_Punctuation S Symbol Sm Math_Symbol Sc Currency_Symbol Sk Modifier_Symbol So Other_Symbol Z Separator Zs Space_Separator Zl Line_Separator Zp Paragraph_Separator C Other Cc Control (also Cntrl) Cf Format Cs Surrogate Co Private_Use Cn Unassigned =begin original Single-letter properties match all characters in any of the two-letter sub-properties starting with the same letter. C and C are special: both are aliases for the set consisting of everything matched by C, C, and C. =end original 単一文字の特性は同じ文字で始まる二文字の任意のサブ特性に含まれる すべての文字にマッチします。 C と C は特別です: 両方とも C, C, C に マッチングする全てからなる集合への別名です。 =head3 B (B<双方向文字型>) =begin original Because scripts differ in their directionality (Hebrew and Arabic are written right to left, for example) Unicode supplies a C property. Some of the values this property can have are: =end original 用字はその方向性で異なるので (例えばヘブライ語とアラビア語は右から左に 書きます) Unicode は以下の特性を C 特性で提供しています。 この特性が持つことができる値の一部は: Value Meaning L Left-to-Right LRE Left-to-Right Embedding LRO Left-to-Right Override R Right-to-Left AL Arabic Letter RLE Right-to-Left Embedding RLO Right-to-Left Override PDF Pop Directional Format EN European Number ES European Separator ET European Terminator AN Arabic Number CS Common Separator NSM Non-Spacing Mark BN Boundary Neutral B Paragraph Separator S Segment Separator WS Whitespace ON Other Neutrals =begin original This property is always written in the compound form. For example, C<\p{Bidi_Class:R}> matches characters that are normally written right to left. Unlike the C> property, this property can have more values added in a future Unicode release. Those listed above comprised the complete set for many Unicode releases, but others were added in Unicode 6.3; you can always find what the current ones are in in L. And L describes how to use them. =end original この特性は常に複合形式で書かれます。 たとえば、C<\p{Bidi_Class:R}> は通常右から左に書く文字にマッチします。 C> 特性とは異なり、 この特性は将来リリースされる Unicode でさらに値が追加されるかもしれません。 これらの上述したものは何回もの Unicode のリリースの間完全な一覧でしたが、 その他の物は Unicode 6.3 で追加されたものです; 現在の内容についてはいつでも L で確認できます。 これらの使い方については L に記述されています。 =head3 B (B<用字>) =begin original The world's languages are written in many different scripts. This sentence (unless you're reading it in translation) is written in Latin, while Russian is written in Cyrillic, and Greek is written in, well, Greek; Japanese mainly in Hiragana or Katakana. There are many more. =end original 世界の言語は多くの異なった用字で書かれています。 この文は(訳文を読んでいない限り)ラテン文字で書かれていますが、ロシア語は キリル文字で書かれています; そしてギリシャ語は、ええと、ギリシャ文字です; 日本語は主にひらがなやカタカナで書かれています。 もっとたくさんあります。 =begin original The Unicode Script and Script_Extensions properties give what script a given character is in. Either property can be specified with the compound form like C<\p{Script=Hebrew}> (short: C<\p{sc=hebr}>), or C<\p{Script_Extensions=Javanese}> (short: C<\p{scx=java}>). In addition, Perl furnishes shortcuts for all C