As per ip.'s answer, here is the Powershell version.
function Remove-Diacritics {
param ([String]$src = [String]::Empty)
$normalized = $src.Normalize( [Text.NormalizationForm]::FormD )
$sb = new-object Text.StringBuilder
$normalized.ToCharArray() | % {
if( [Globalization.CharUnicodeInfo]::GetUnicodeCategory($_) -ne [Globalization.UnicodeCategory]::NonSpacingMark) {
[void]$sb.Append($_)
}
}
$sb.ToString()
}
# Test data
@("Rh?ne", "Basíl", "?bo", "", "Gr?s?nt?rm?") | % { Remove-Diacritics $_ }
Output:
Rhone
Basil
Abo
Grasantorma
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…