Unicode...ianWidth(3)
π NAME π
okay bestie, welcome to the Unicode::EastAsianWidth manual page β the whole vibe is East Asian Width properties. that's it, that's the name. π
β¨ SYNOPSIS β¨
first up, you load it like this:
use Unicode::EastAsianWidth;
$_ = chr(0x2010); # HYPHEN, an ambiguous-width character
/\p{InEastAsianAmbiguous}/; # True
/\p{InFullwidth}/; # False
so chr(0x2010) is HYPHEN, and it's an ambiguous-width character, and matching /\p{InEastAsianAmbiguous}/; gives # True while /\p{InFullwidth}/; gives # False. slay.
want to mark ambiguous-width characters as InFullwidth? do the BEGIN block before the use, like:
BEGIN { $Unicode::EastAsianWidth::EastAsian = 1; }
use Unicode::EastAsianWidth;
$_ = chr(0x2010); # HYPHEN, an ambiguous-width character
/\p{InFullwidth}/; # True
same HYPHEN, but now /\p{InFullwidth}/; is # True. periodt. β¨
π¦ DESCRIPTION π¦
this module gives you user-defined Unicode properties that deal with the width status of East Asian characters, exactly as specified in <http://www.unicode.org/unicode/reports/tr11/>. iconic.
it exports the following functions into the caller's scope, so Perl's Unicode matching system can use them:
InEastAsianFullwidthInEastAsianHalfwidthInEastAsianAmbiguousInEastAsianNarrowInEastAsianWideInEastAsianNeutral
in accord with TR11 (cited above), there are also two extra context-sensitive properties exported:
InFullwidthβ the union ofFullwidthandWideInHalfwidthβ the union ofHalfwidth,NarrowandNeutral
by default, ambiguous characters are treated as part of InHalfwidth. but bestie, you can modify that behaviour by assigning a true value to $Unicode::EastAsianWidth::EastAsian at compile time inside a BEGIN block, before you load this module:
BEGIN { $Unicode::EastAsianWidth::EastAsian = 1; }
use Unicode::EastAsianWidth;
setting$Unicode::EastAsianWidth::EastAsianat run-time used to work on Perl versions between5.8and5.14because of an implementation detail, but it will no longer work on Perl5.16and later versions, so it is not recommended. no cap, don't do the run-time thing. π
π SEE ALSO π
go check out perlunicode and the TR11 report at <http://www.unicode.org/unicode/reports/tr11/>. iykyk. π¦
π AUTHORS π
the author is Audrey Tang <cpan@audreyt.org>. bow down. π
π LICENSE π
this work is under the CC0 1.0 Universal license.
To the extent possible under law, ει³³ has waived all copyright and related or neighboring rights to Unicode-EastAsianWidth. that's huge. π«Ά
This work is published from Taiwan. πΈ
the license link is <http://creativecommons.org/publicdomain/zero/1.0>. go read it, bestie. π
that's the whole page, bestie β source/version: perl v5.42.0, dated 2019-09-27, and it's the Unicode::EastAsianWidth manual. mwah πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Unicode-EastAsianWidth 12.0-160000.2.2 Β· CC0-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms