An interesting problem that no doubt someone here has come across before.
一个有趣的问题,毫无疑问,此前有人遇到过。
I'm reading a CSV file that contains some values wrapped in quotes, I came across a problem today were my app couldn't read the file as the value was wrapped in cury quotation marks and not square quotation marks. Is this an encoding problem? I simply replaced the quotes replacing curly quote with ".
我正在读一个CSV文件,其中包含一些用引号括起来的值,我今天遇到的问题是我的应用程序无法读取文件,因为值包含在cury引号中而不是方括号。这是编码问题吗?我只是用“替换引号替换卷曲引号”。
Can someone explain why this happens and what I can do about it? I'm using C#
有人可以解释为什么会发生这种情况以及我能做些什么呢?我正在使用C#
2 个解决方案
#1
4
I suspect the data was copied and pasted from a document created using Word.
我怀疑数据是从使用Word创建的文档中复制和粘贴的。
By default Word 2003 will convert "straight quotes" to what it calls “smart quotes”. You can override this behavior using Tools/AutoCorrect Options/AutoFormat as you type.
默认情况下,Word 2003会将“直引号”转换为所谓的“智能引号”。您可以在键入时使用工具/自动更正选项/自动套用格式覆盖此行为。
#2
3
I think that the curly quotation marks you're referring to are actually "smart quotes," which are usually inserted by Microsoft Office products. IIRC, they have a Unicode value, but if you're dealing with ASCII only or well-formed XML they wreak havoc.
我认为你所指的卷曲引号实际上是“智能引号”,通常由Microsoft Office产品插入。 IIRC,它们具有Unicode值,但如果您只处理ASCII或格式良好的XML,则会造成严重破坏。
#1
4
I suspect the data was copied and pasted from a document created using Word.
我怀疑数据是从使用Word创建的文档中复制和粘贴的。
By default Word 2003 will convert "straight quotes" to what it calls “smart quotes”. You can override this behavior using Tools/AutoCorrect Options/AutoFormat as you type.
默认情况下,Word 2003会将“直引号”转换为所谓的“智能引号”。您可以在键入时使用工具/自动更正选项/自动套用格式覆盖此行为。
#2
3
I think that the curly quotation marks you're referring to are actually "smart quotes," which are usually inserted by Microsoft Office products. IIRC, they have a Unicode value, but if you're dealing with ASCII only or well-formed XML they wreak havoc.
我认为你所指的卷曲引号实际上是“智能引号”,通常由Microsoft Office产品插入。 IIRC,它们具有Unicode值,但如果您只处理ASCII或格式良好的XML,则会造成严重破坏。