Remove all non-ASCII characters from string

Viewed 66279

I have a C# routine that imports data from a CSV file, matches it against a database and then rewrites it to a file. The source file seems to have a few non-ASCII characters that are fouling up the processing routine.

I already have a static method that I run each input field through but it performs basic checks like removing commas and quotes. Does anybody know how I could add functionality that removes non-ASCII characters too?

8 Answers
strText = Regex.Replace(strText, @"[^\u0020-\u007E]", string.Empty);
Related