我需要对诸如“quee”之类的字符串进行规范化,但我似乎无法将扩展的 ASCII 字符(例如 é、á、í 等)转换为罗马/英语版本。我尝试了几种不同的方法,但到目前为止没有任何效果。关于这个一般主题有相当多的材料,但我似乎找不到这个问题的有效答案。
这是我的代码:
#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 "\nArray Output: @breakdown\n";
}
$lowercase = join( "",@breakdown );
}