The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Unicode::Precis::Utils - Utility functions for PRECIS enforcement

DESCRIPTION

This module provides some utility functions used by enforcement and comparison of PRECIS Framework.

Note that the word "UTF-8" in this document is used in its proper meaning.

Functions

compareExactly ( $stringA, $stringB )

Checks if $stringA and $stringB are an exact octet-for-octet match, and returns 1 or 0. Unicode strings are considered to be the same as corresponding UTF-8 bytestrings. If any of $stringA and $stringB are not defined, returns undef.

Functions below maps characters in Unicode string or UTF-8 bytestring. Malformed sequences in the string are skipped and kept intact. If mapping succeeded, modifys string argument if possible, and returns it. Otherwise, returns undef.

foldCase ( $string )

Applys Unicode Default Case Folding to $string.

mapSpace ( $string )

Maps non-ASCII spaces (those in general category Zs) to SPACE (U+0020).

decomposeWidth ( $string )

Maps fullwidth and halfwidth characters in $string to their decomposition mappings.

Exports

None are exported by default. All functions above may be exported by :all tag.

RESTRICTIONS

This module can not handle Unicode string on EBCDIC platforms.

CAVEATS

  • The mappings this module can provide are restricted by Unicode database of Perl core.

SEE ALSO

Unicode::Precis.

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.