in reply to removing accent

A snippet I had laying around, from some lost node:
#!/usr/bin/perl use warnings; use strict; use Unicode::Normalize; use Encode; my $string = "+lsctzùïåé}"; print "$string\n"; $string = decode("windows-1250", $string); $string = NFD($string); $string =~ s/\pM//og; print "$string\n";

I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re^2: removing accent
by fizbin (Chaplain) on Aug 23, 2005 at 02:53 UTC
    Huh. When I had to do this recently, I used NFKD. I guess from codepage 1250 there's no difference between the two, but for codepage 1252, there is - NFKD squashes superscripted 2s and 3s to regular 2s and 3s, and changes "½" to "1/2".

    Of course, whether or not such a squashing is desireable will depend on the application.

    -- @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/