Re: Stripping out Unicode combining characters (diacritics)

[email protected] ("David Kaufman")
Newsgroups perl.perl4lib,perl.i18n
Message-ID <[email protected]>
Hi Michael,

"Doran, Michael D" <[email protected]> wrote:

> I'm trying to strip out combining diacritics from some form input using 
> this code:
> [...]
> $sans_diacritics  =~ s/\p{M}*//g;

I do it like this:

use Encode;
use Unicode::Normalize qw(normalize);

my $ascii = encode('ascii', normalize('KD', $utf8), sub { $_[0]='' });
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.