Removing hidden characters from within strings

前端 未结 8 1287
既然无缘
既然无缘 2020-12-01 10:37

My problem:

I have a .NET application that sends out newsletters via email. When the newsletters are viewed in outlook, outlook displays a question mark in place

8条回答
  •  眼角桃花
    2020-12-01 11:18

    string output = new string(input.Where(c => !char.IsControl(c)).ToArray());
    

    This will surely solve the problem. I had a non printable substitute characer(ASCII 26) in a string which was causing my app to break and this line of code removed the characters

提交回复
热议问题