mugwumpjism has asked for the wisdom of the Perl Monks concerning the following question:
Is there an easy way to normalize and lowercase a unicode string?
This works for probably most Latin languages:
However this doesn't work for, say, Greek. It seems that the Perl Unicode API would require this:use Unicode::Normalize; my $lower_nfc = NFC(lc(NFD($string)));
Surely there's an easier way...use Unicode::UCD qw(charinfo); use Unicode::Normalize; my $nfd_string = NFD($string); $nfd_string =~ s{(\p{Lu})}{chr(hex(charinfo(ord($1))->{lower}))}ge; my $nfc_string = NFC($nfd_string);
$h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/." ."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Lowercase and normalize a unicode string
by ikegami (Patriarch) on Nov 02, 2010 at 04:51 UTC |
Back to
Seekers of Perl Wisdom