我希望能够在 Windows Phone 7 中从字符串中移除重音符号(变音符号)。这里的解决方案适用于 .NET(桌面版)。但是,WP7 字符串没有
Normalize
方法。
有人建议将字符串更改为字节,但我不知道他的意思。如何移除重音符号?Normalize
方法。
有人建议将字符串更改为字节,但我不知道他的意思。如何移除重音符号?I use this:
public static string RemoveAccents(this string accentedStr)
{
byte[] tempBytes = Encoding.GetEncoding("ISO-8859-8").GetBytes(accentedStr);
return Encoding.UTF8.GetString(tempBytes, 0, tempBytes.Length);
}
编辑:这个解决方案适用于Windows 8应用程序,但不适用于Windows Phone。到目前为止,我找到的最好的解决方案是手动处理:
http://invokeit.wordpress.com/2011/10/06/how-to-remove-diatrics-accent-marks-in-windows-phone-7-x/