Q:

ASP.NET Smart quotes parsing issue in a CSV file

The ASP.NET application that I've been working on parses regular quotes and symbols happily. Other than the smart quotes in the CSV file created using MS Excel.
The following is the code I use:
for (int i = 0; i < ds.Tables["Comments"].Rows.Count; i++) {
value = ParseSmartQuotes(ds.Tables["Comments"].Rows[i][col.FieldName].ToString());

Within the ParseSmartQuotes method, I tried a lot of things. Some of them include:

replace MSWord smart quotes in asp.net webform
C# How to replace Microsoft's Smart Quotes with straight quotation marks?

A solution to replace the smart quotes with regular quotes (or) display the smart quotes as such in the web page would be highly appreciated.

A:

Your parsing code shouldn't be confused by smart quotes. The parser should only look for ASCII quotes as delimiters; smart quotes should be regarded as content--not delimiters--and stored as Unicode.
Is your parser written from scratch? If so, why? There is a high-quality CSV reader available that has worked well for me. It doesn't have any special handling for smart quotes, but it handles Unicode.

