On Wed, Aug 16, 2006 at 04:25:13PM +0200, Dr.Ruud wrote:
: Comparing strings in Perl5, using NFKD:
: 
: perl5 -MUnicode::Normalize -we '
:   ($\, $,) = ("\n", "\t") ;
:   $x = qq{Henry IV} ;
:   $y = qq{Henry \x{2163}} ;
:   print qq{<$x>}, qq{<$y>}, length $x, length $y, $x eq $y ? 1 : 0 ;
: # $x = NFKD $x ;
:   $y = NFKD $y ;
:   print qq{<$x>}, qq{<$y>}, length $x, length $y, $x eq $y ? 1 : 0 ;
: '
: Wide character in print at -e line 5.
: <Henry IV>      <Henry �.�>     8       7       0
: <Henry IV>      <Henry IV>      8       8       1
: 
: 
: How will the Str type do this?

That'd just be:

    eqv($x, $y, :(NFKD $^s))

or some such, give or take a little notation in the signature to force MMD
to match a Str and coerce to NFKD.  This is mentioned in S03 as a subproblem
of the general canonicalization/collation problem.  It should be using the
same underlying semantics as

    cmp($x, $y, :(NFKD $_))

or
    sort :(NFKD $_), @strings;

Larry

Reply via email to