0

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:

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.

4

2 回答 2

1

您的解析代码不应被智能引号混淆。解析器应该只寻找 ASCII 引号作为分隔符;智能引号应被视为内容——而不是分隔符——并以 Unicode 格式存储。

您的解析器是从头开始编写的吗?如果是这样,为什么?有一个高质量的 CSV 阅读器可供我使用。它对智能引号没有任何特殊处理,但它处理 Unicode。

于 2011-08-08T22:12:14.727 回答
0

第二个链接中的回复之一提到了对文本进行 html 编码。你试过吗?链接在这里:

http://msdn.microsoft.com/en-us/library/73z22y6h.aspx

于 2011-08-08T21:46:58.087 回答