Why doesn't Đ get flattened to D when Removing Accents/Diacritics

后端 未结 5 1887
你的背包
你的背包 2021-01-04 01:37

I\'m using this method to remove accents from my strings:

static string RemoveAccents(string input)
{
    string normalized = input.Normalize(NormalizationFo         


        
5条回答
  •  说谎
    说谎 (楼主)
    2021-01-04 02:00

    I have to admit that I'm not sure why this works but it sure seems to

    var str = "æøåáâăäĺćçčéęëěíîďđńňóôőöřůúűüýţ";
    var noApostrophes = Encoding.ASCII.GetString(Encoding.GetEncoding("Cyrillic").GetBytes(str)); 
    

    => "aoaaaaalccceeeeiiddnnooooruuuuyt"

提交回复
热议问题