bcrowell2 has asked for the wisdom of the Perl Monks concerning the following question:

Can anyone tell me how to strip the accents off of a utf-8 string? Thanks in advance!

Replies are listed 'Best First'.
Re: stripping accents
by fokat (Deacon) on Feb 02, 2003 at 04:58 UTC

    Use Unicode::Map8. This is a fragment of an article of mine (sorry, can't provide a direct link right now) that uses it:

    use Unicode::Map8; my $map = Unicode::Map8->new('ASCII') print $map->to8($map->to16($wd->decode($my_utf8_string)));

    Note that using ASCII to do the conversion, will simply strip the accents. You can usa addpair() to provide translations. For instance, you can use a instead of á.

    Best regards

    -lem, but some call me fokat

      I. What $wd scalar stands for ?

        jeteve asked along these lines...

        I. What $wd scalar stands for ?

        In this example, $wd is a MIME::WordDecoder object.

        See this (part of this) for more complete usage. At the time, I could not provide a link because the article wasn't published yet.

        Best regards

        -lem, but some call me fokat

      I. What $wd stands for ?