Is there any alternative to string.Normalize() in WinRT? I want to simply remove accents from input strings using this approach, but I cannot find anywhere this method in WinRT.
Asked
Active
Viewed 1,329 times
2 Answers
5
I've discovered here quick and short solution, that works just fine in WinRT:
public static string RemoveAccents(this string accentedStr)
{
byte[] tempBytes = Encoding.GetEncoding("ISO-8859-8").GetBytes(accentedStr);
return Encoding.UTF8.GetString(tempBytes, 0, tempBytes.Length);
}

Community
- 1
- 1

Martin Suchan
- 10,600
- 3
- 36
- 66
-
It seems, this function turns Cyrillic symbols to question marks. – Yaroslav Mar 12 '15 at 22:17
-
2This is not a correct or wise solution. Converting to ISO-8859-8 and then to UTF-8 is not Unicode normalization. – nexus Aug 05 '15 at 18:52
0
You will not find any alternative to String.Normalize in WinRT because it is available as part of the .NET Core Profile that is available to Metro style apps. Docs. If you are using C++, see this question.