| 1 |
wakaba |
1.1 |
=head1 NAME |
| 2 |
|
|
|
| 3 |
|
|
Char::Normalize::FullwidthHalfwidth - Fullwidth/halfwidth character |
| 4 |
|
|
normalization |
| 5 |
|
|
|
| 6 |
|
|
=head1 SYNOPSIS |
| 7 |
|
|
|
| 8 |
|
|
use Char::Normalize::FullwidthHalfwidth qw/normalize_width/; |
| 9 |
|
|
|
| 10 |
|
|
$s = <>; |
| 11 |
|
|
normalize_width (\$s); |
| 12 |
|
|
print $s; |
| 13 |
|
|
|
| 14 |
|
|
=head1 DESCRIPTION |
| 15 |
|
|
|
| 16 |
|
|
The C<Char::Normalize::FullwidthHalfwidth> module provides a function |
| 17 |
|
|
that normalizes fullwidth/halfwidth compatibility characters into |
| 18 |
|
|
their canonical representations. |
| 19 |
|
|
|
| 20 |
|
|
=head1 FUNCTION |
| 21 |
|
|
|
| 22 |
|
|
This module provides a function, C<normalize_width>. It can be |
| 23 |
|
|
imported to a package by standard C<Exporter> method, as: |
| 24 |
|
|
|
| 25 |
|
|
use Char::Normalize::FullwidthHalfwidth qw/normalize_width/; |
| 26 |
|
|
|
| 27 |
|
|
Note that the C<use> statement does not export anything unless the |
| 28 |
|
|
function name was explicitly specified. |
| 29 |
|
|
|
| 30 |
|
|
Alternatively, you can invoke the function in its fully qualified form |
| 31 |
|
|
as: |
| 32 |
|
|
|
| 33 |
|
|
require Char::Normalize::FullwidthHalfwidth; |
| 34 |
|
|
Char::Normalize::FullwidthHalfwidth::normalize_width (\$scalarref); |
| 35 |
|
|
|
| 36 |
|
|
=over 4 |
| 37 |
|
|
|
| 38 |
|
|
=item C<normalize_width (I<$scalarref>)> |
| 39 |
|
|
|
| 40 |
|
|
Normalize the fullwidth/halfwidth characters in the scalar referenced |
| 41 |
|
|
by the argument into their preferable form. The argument must be a |
| 42 |
|
|
scalar reference. The scalar is treated as a character string |
| 43 |
|
|
(possibly with the utf8 flag set), not a byte string. The function |
| 44 |
|
|
returns the scalar reference. |
| 45 |
|
|
|
| 46 |
|
|
The function performs the following conversions: |
| 47 |
|
|
|
| 48 |
|
|
=over 4 |
| 49 |
|
|
|
| 50 |
|
|
=item A character C<U+3000> C<IDEOGRAPHIC SPACE> (so-called fullwidth space) |
| 51 |
|
|
|
| 52 |
|
|
Replaced by a C<U+0020> C<SPACE> (so-called halfwidth space) |
| 53 |
|
|
character. |
| 54 |
|
|
|
| 55 |
|
|
=item Characters in the range C<U+FF01>..C<U+FF5E> (so-called fullwidth ASCII characters) |
| 56 |
|
|
|
| 57 |
|
|
Replaced by a character in the range C<U+0021>..C<U+007E> (so-called |
| 58 |
|
|
halfwidth ASCII characters). |
| 59 |
|
|
|
| 60 |
|
|
=item Characters in the range C<U+FF61>..C<U+FF9F> (halfwidth Katakana) |
| 61 |
|
|
|
| 62 |
|
|
Replaced by a corresponding so-called fullwidth Katakana (or |
| 63 |
|
|
ideographic punctuation). Note that C<U+FF9E> C<HALFWIDTH KATAKANA |
| 64 |
|
|
VOICED SOUND MARK> and C<U+FF9F> C<HALFWIDTH KATAKANA SEMI-VOICED |
| 65 |
|
|
SOUND MARK> are replaced by C<U+3099> C<COMBINING KATAKANA-HIRAGANA |
| 66 |
|
|
VOICED SOUND MARK> and C<U+309A> C<COMBINING KATAKANA-HIRAGANA |
| 67 |
|
|
SEMI-VOICED SOUND MARK> respectively, not their spacing variants. |
| 68 |
|
|
|
| 69 |
|
|
=item Characters in the range C<U+FFE0>..C<U+FFE6> (fullwidth symbols) |
| 70 |
|
|
|
| 71 |
|
|
Replaced by a corresponding canonical character. |
| 72 |
|
|
|
| 73 |
|
|
=back |
| 74 |
|
|
|
| 75 |
|
|
=back |
| 76 |
|
|
|
| 77 |
|
|
=head1 BUGS |
| 78 |
|
|
|
| 79 |
|
|
Not all compatibility characters in the fullwidth and halfwidth block |
| 80 |
|
|
of the Unicode Standard are currently supported - especially, |
| 81 |
|
|
halfwidth Hangul syllables are not converted to their fullwidth |
| 82 |
|
|
equivalents. A future version of this module is expected to address |
| 83 |
|
|
this issue by extending the conversion table. |
| 84 |
|
|
|
| 85 |
|
|
=head1 AUTHOR |
| 86 |
|
|
|
| 87 |
|
|
Wakaba <[email protected]>. |
| 88 |
|
|
|
| 89 |
|
|
=head1 HISTORY |
| 90 |
|
|
|
| 91 |
|
|
This module was originally developed as part of SuikaWiki |
| 92 |
|
|
L<http://suika.fam.cx/~wakaba/wiki/sw/n/SuikaWiki>. |
| 93 |
|
|
|
| 94 |
|
|
=head1 LICENSE |
| 95 |
|
|
|
| 96 |
|
|
Copyright 2008 Wakaba <[email protected]> |
| 97 |
|
|
|
| 98 |
|
|
This program is free software; you can redistribute it and/or |
| 99 |
|
|
modify it under the same terms as Perl itself. |
| 100 |
|
|
|
| 101 |
|
|
=cut |
| 102 |
|
|
|
| 103 |
|
|
## $Date: 2008/10/21 07:51:59 $ |