How to replace special characters with their equivalent (such as “ á ” for “ a”) in C#?

后端 未结 4 1455
悲&欢浪女
悲&欢浪女 2020-12-16 00:45

I need to get the Portuguese text content out of an Excel file and create an xml which is going to be used by an application that doesn\'t support characters such as \"ç\",

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 01:44

    The perform is better with this solution:

    string test = "áéíóúç";
    
    string result = Regex.Replace(test .Normalize(NormalizationForm.FormD), "[^A-Za-z| ]", string.empty);
    

提交回复
热议问题