NAME
Unicode::Precis - RFC 7564 PRECISフレームワーク
SYNOPSIS
use Unicode::Precis;
$precis = Unicode::Precis->new(options...);
$string = $precis->enforce($input);
$equals = $precis->compare($inputA, $inputB);
DESCRIPTION
Unicode::Precis は、PRECISフレームワークに基づいて UTF-8バイト文字列やユニコード文字列への適用を行う。
なお当モジュールは、バイト文字列をアップグレードすることなくUTF-8列として扱う。
Methods
- new ( options ... )
-
コンストラクタ。 Unicode::Precisのインスタンスを作成する。 次のオプションを指定できる。
- WidthMappingRule => 'Decomposition'
-
指定すると、半角および全角のキャラクタをそれらの分解マッピングに変換する (decomposeWidth()を使う)。
- AdditionalMappingRule => 'Space'
-
指定すると、非ASCIIの空白をASCIIの空白に変換する (mapSpace()を使う)。
- CaseMappingRule => 'Fold'
-
指定すると、大文字およびタイトル文字を小文字に変換する (foldCase()を使う)。
- NormalizationRule => 'NFC' | 'NFKC' | 'NFD' | 'NFKD'
-
指定すると、文字列を指定の正規化形式で正規化する。
- DirectionalityRule => 'BiDi'
-
指定すると、右書き文字を含む文字列をBiDi規則で検査する。
- StringClass => 'FreeFormClass' | 'IdentifierClass'
-
指定すると、文字列を指定の文字列クラスで検査する。
- OtherRule => $subref
-
指定すると、文字列を$subrefで参照するサブルーチンの結果によって変換・検査する。
- compare ( $stringA, $stringB )
-
インスタンスメソッド。 文字列を比較する。 両方の文字列の適用が成功すれば、compareExactly() を使って両者を比較し、
1
か0
を返す。 そうでなければ、undef
を返す。引数$stringA、$stringBは変更されない。
- enforce ( $string )
-
インスタンスメソッド。 文字列の適用を行う。 処理が成功すれば、引数$stringを変更し、それを返す。 そうでなければ、
undef
を返す。
Exports
なにもエクスポートしない。
CAVEATS
当モジュールが提供できるレパートリは、Perl 本体のユニコードデータベースが提供するものにかぎられる。 これを超えるキャラクタは、最新版のユニコードで利用可能であっても 「未割り当て」とみなされ、認められない。下表に、Perl の各版が実装するユニコードの版を示す。
Perl's version Implemented Unicode version
------------------ ---------------------------
5.8.7, 5.8.8 4.1.0
5.10.0 5.0.0
5.8.9, 5.10.1 5.1.0
5.12.x 5.2.0
5.14.x 6.0.0
5.16.x 6.1.0
5.18.x 6.2.0
5.20.x 6.3.0
RESTRICTIONS
当モジュールはEBCDICプラットフォームに対応しない。
SEE ALSO
RFC 7564 PRECIS Framework: Preparation, Enforcement, and Comparison of Internationalized Strings in Application Protocols. https://tools.ietf.org/html/rfc7564.
Unicode::BiDiRule, Unicode::Normalize, Unicode::Precis::Preparation, Unicode::Precis::Utils.
AUTHOR
Hatuka*nezumi - IKEDA Soji, <hatuka@nezumi.nu>
COPYRIGHT AND LICENSE
Copyright (C) 2015 by Hatuka*nezumi - IKEDA Soji
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. For more details, see the full text of the licenses at <http://dev.perl.org/licenses/>.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.