Perl Unicode::EastAsianWidth

Packaging for Opensuse

Matching Han and other double-width characters in regular expressions

1 Chronology

1.1 2009-04-22 InFullwidth works, InEastAsianFullwidth maybe not

  • A test script shows how it works:
#!/usr/bin/perl
# Time-stamp: <2009-04-22 00:13:43 phm>

use Unicode::EastAsianWidth;
use utf8;
use Encode qw(encode decode);
my $str = '網誌';
($val) = $str =~ m(\A(\p{InEastAsianWide}+)\Z);
print encode('UTF-8', $val), "\n";
$str = '123';
($val) = $str =~ m((\p{InFullwidth}{2}+));
print encode('UTF-8', $val), "\n";

  • Output is
    網誌
    12
    
  • I was not able to figure out what InEastAsianFullwidth matches
  • We use this in A2E::Mktdir to allow us to require certain document metadata to be written in wide characters

2 Resources

deplate
http://a2e.de/adv/pak/perl-Unicode-EastAsianWidth
© 2009-04-10 Hartmut PILCH