-
1. Re: No extra quotes in data
cfang Dec 19, 2016 4:10 PM (in response to sunitha.n)I think it has to do with the inch symbol as in 12.5", which happens to be the same as your quoteChar. Jackson csv generator thinks it's really necessary to quote the whole field, and prefixing each inch symbol with a double-quote.
7. If double-quotes are used to enclose fields, then a double-quote
appearing inside a field must be escaped by preceding it with
another double quote. For example:
"aaa","b""bb","ccc"
You can try a different quote char to avoid this situation (bys setting quoteChar batch property in jacksonCsvItemWriter. But I think the generated csv output by Jackson is valid
-
2. Re: No extra quotes in data
sunitha.n Mar 10, 2017 11:12 AM (in response to cfang)I got an issue after using property quotechar getting extra quotes when there is '#' character
<writer ref="jacksonCsvItemWriter">
<properties>
<property name="resource" value="#{jobProperties['deliveryFilename']}" />
<property name="writeMode" value="overwrite" />
<property name="columnSeparator" value="|" />
<property name="quoteChar" value="`" />
<property name="beanType" value="java.util.Map" />
-
3. Re: No extra quotes in data
cfang Mar 10, 2017 11:42 AM (in response to sunitha.n)# is the comment character, so Jackson csv generator decides to quote the entire field value, so this value starting with # won't be interpreted as a comment.
-
4. Re: No extra quotes in data
sunitha.n Mar 10, 2017 12:08 PM (in response to cfang)Don't want extra quotes even for special characters which are there in record .What property can be used in jackson csv item writer to remove extra quotes even for special characters ?
I have used csvgenerator option also in jacksoncsvitem writer
<writer ref="jacksonCsvItemWriter">
<properties>
<property name="resource" value="#{jobProperties['deliveryFilename']}" />
<property name="writeMode" value="overwrite" />
<property name="columnSeparator" value="|" />
<property name="quoteChar" value="`" />
<property name="beanType" value="java.util.Map" />
<property name="useHeader" value="false" />
<property name="csvGeneratorFeatures" value="STRICT_CHECK_FOR_QUOTING=true,ALWAYS_QUOTE_STRINGS=false"/>
-
5. Re: No extra quotes in data
cfang Mar 10, 2017 12:45 PM (in response to sunitha.n)can quoteChar be disabled? · Issue #32 · FasterXML/jackson-dataformat-csv · GitHub
See the above Jackson CSV issue.
You can try setting this batch property:
<property name="quoteChar" value="\0"/>
to effectively disable quoting.
I'll fix JBeret JacksonCsvItemWriter to better support disabling quoting.
-
6. Re: No extra quotes in data
cfang Mar 10, 2017 12:52 PM (in response to cfang)Add option to disable quoteChar in JacksonCsvItemWriter
-
7. Re: No extra quotes in data
sunitha.n Mar 10, 2017 1:00 PM (in response to cfang)I used <property name="quoteChar" value="\0"/> but its not working out.
-
8. Re: No extra quotes in data
cfang Mar 10, 2017 1:38 PM (in response to sunitha.n)You're right. "\0" is java way of representing empty char, so it won't work in xml. I'll test a better fix.