引号和字段分隔符之间的数据 [英] Data between quotes and field separator
问题描述
在下面给出的示例中,最后一行没有上传.我收到一个错误:
In the example given below, the last line is not uploaded. I get an error:
Data between close double quote (") and field separator:
这看起来像一个错误,因为管道符号之间的所有数据都应该被视为一个字段.
This looks like a bug since all the data between pipe symbol should be treated as a single field.
架构:一:字符串,二:字符串,三:字符串,四:字符串
Schema: one:string,two:string,three:string,four:string
上传文件:
This | is | test only | to check quotes
second | line | "with quotes" | no text
third line | with | "start quote" and | a word after quotes
处理上面的第一行和第二行.但不是第三个.
The first and second line above is processed. But not the third.
更新:
有人可以解释为什么下面的工作除了第三行?
Can some please explain why does the following work except the third line?
This | is | test only | to check quotes
second | line | "with quotes" | no text
third line | with | "start quote" and | a word after quotes
forth line | enclosed | {"GPRS","MCC_DETECTED":false,"MNC_DETECTED":false} | how does this work?
fifth line | with | {"start quote"} and | a word after quotes
对此可以有一些奇特的解释.从最终用户的角度来看,这是荒谬的.
There can be some fancy explanation to this. From the end user perspective this is absurd.
推荐答案
来自 CSV RFC4180 页面: 如果使用双引号将字段括起来,那么出现在字段内的双引号必须通过在其前面加上另一个双引号来转义."
您可能想要这样做:
This | is | test only | to check quotes
second | line | "with quotes" | no text
third line | with | " ""start quote"" and " | a word after quotes
在此处详细了解我们的 CSV 输入格式.
More about our CSV input format here.
这篇关于引号和字段分隔符之间的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!