Convert special characters to normal

亡梦爱人 提交于 2019-12-04 12:36:08
Dustin Kingen

See: Does .NET transliteration library exists?

UnidecodeSharpFork

Usage:

var result = "Helloæ".Unidecode();
Console.WriteLine(result) // Prints Helloae

There is no direct mapping between æ and ae they are completely different unicode code points. If you need to do this you'll most likely need to write a function that maps the offending code points to the strings that you desire.

Per the comments you may need to take a two stage approach to this:

  1. Remove the diacritics and combining characters per the link to the possible duplicate
  2. Map any characters left that are not combining to alternate strings
switch(badChar){
   case 'æ':
   return "ae";
   case 'ø':
   return "oe";
   // and so on
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!