【问题标题】:How to remove accent from string in WP7如何在 WP7 中从字符串中删除重音符号
【发布时间】:2012-10-27 02:28:37
【问题描述】:

我想从 Windows Phone 7 中的字符串中删除重音符号(变音符号)。 解决方案 here 适用于 .NET(桌面版)。但是,WP7 字符串没有Normalize 方法。

Someone suggest change from string to byte,但我不知道他是什么意思。如何去除重音?

【问题讨论】:

    标签: string windows-phone-7 diacritics normalize non-ascii-characters


    【解决方案1】:

    我用这个:

    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/

    【讨论】:

    • 我已经在 codeproject 上看到过,但是在 WP7 中我收到 ISO-8859-8' is not a supported encoding name
    • 我必须接受来自链接的手动解决方案。 =[ 但效果很好。
    猜你喜欢
    • 2015-08-30
    • 2012-01-21
    • 2010-09-19
    • 2012-12-10
    • 2010-11-04
    • 2019-01-09
    • 2012-03-30
    • 1970-01-01
    相关资源
    最近更新 更多