我需要一个像“quée”这样的字符串的正常化,我似乎无法将扩展的 ASCII 字符如 é, á, í 等转换成罗马/ english 版本。 我尝试过几种不同的方法,但至今为止没有任何效果。 关于这个一般性主题,有相当数量的材料,但我似乎无法找到解决问题的可行答案。
这是我的代码:
#transliteration solution (works great with standard chars but doesn t find the
#special ones) - I ve tried looking for both x{130} and é with the same result.
$mystring =~ tr/\x{130}/e/;
#converting into array, then iterating through and replacing the specific char
#( same result as the above solution )
my @breakdown = split( "",$mystring );
foreach ( @breakdown ) {
if ( $_ eq "x{130}" ) {
$_ = "e";
print "
Array Output: @breakdown
";
}
$lowercase = join( "",@breakdown );
}