Looking at
Text::StripAccents source code, it seems quite inefficient: it splits the string in chars, loops over them replacing accented ones by their ASCII equivalent and then joins the string again.
A regular expresion substitution could do it:
my %table = ( 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => '
+A', 'Å' => 'A',
'Ç' => 'C',
'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E',
'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I',
'Ñ' => 'N',
'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => '
+O',
'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U',
'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => '
+a', 'å' => 'a',
'ç' => 'c',
'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e',
'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i',
'ñ' => 'n',
'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => '
+o',
'ß' => 'ss',
'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u',
'ý' => 'y' );
sub strip_accents {
my $str = shift;
$str =~ s/([^\x00-\x7F])/$table{$1} || '?'/ge;
$str
}
It's so simple that it makes me think if a module is actually required...
And BTW, "unaccenting" chars is not a unique transformation, it depends on the text language. For instance, in German 'ü' should be mapped to 'ue' (see Lingua::DE::ASCII), but in Spanish it should be mapped to 'u'.