# DataReader: error parsing data that contains double quotes

**URL:** <https://forum.cloverdx.com/t/datareader-error-parsing-data-that-contains-double-quotes/434>\
**Category:** CloverDX Platform\
**Created:** [November 13, 2008, 12:00am UTC](https://forum.cloverdx.com/t/datareader-error-parsing-data-that-contains-double-quotes/434 "2008-11-13T00:00:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![achan](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@achan](https://forum.cloverdx.com/u/achan)\
**Post date:** [November 13, 2008, 12:00am UTC](https://forum.cloverdx.com/t/datareader-error-parsing-data-that-contains-double-quotes/434/1 "2008-11-13T00:00:00Z")

</div>

Hi,

If my data looks like this:

“ref”,“buyer”,“amount”  
“1000-1"a”,“albert”,“10.00”  
“1000-2"b”,“tony”,“20.00”

looks like DataReader cannot parse the record correctly since i have an embedded double-quote in the my first field “ref”, e.g 1000-1"a…

i read from this posting ([http://forum.cloveretl.org/viewtopic.php?t=358](http://forum.cloveretl.org/viewtopic.php?t=358)) that the embedded single quote in the data was fixed, but how about double-quotes?

i thought Clover just need to read the start of a quote to the quote that is right before the delimiter and treat the string read as input data, right?

or is there workaround?

thanks,  
al

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [November 14, 2008, 7:55am UTC](https://forum.cloverdx.com/t/datareader-error-parsing-data-that-contains-double-quotes/434/2 "2008-11-14T07:55:38Z")

</div>

Hello,  
only different type of quote can be embedded into field value (double quote can be embedded in single quoted string and vice versa) in other cases value is regarded as imparseable.  
The work around is to set _quotedStrings_ attribute to _false_ and strip the quotes in Reformat.

---

<div class="post-metadata">

**Author:** ![achan](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@achan](https://forum.cloverdx.com/u/achan)\
**Post date:** [November 14, 2008, 5:29pm UTC](https://forum.cloverdx.com/t/datareader-error-parsing-data-that-contains-double-quotes/434/3 "2008-11-14T17:29:57Z")

</div>

Hi Agata,

I cannot set quotedString to false because I have embedded deliimiter in my quoted data also… something like this:

“ref”,“buyer”,“amount”  
“10,00-1"“a”,“albert”,“10.00”  
“10,00-2”'b”,“tony”,“20.00”

This type of data file is created when I export from Excel to a CSV file…

Is there any other option to handle this case?

Thanks,  
al

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [November 18, 2008, 7:49am UTC](https://forum.cloverdx.com/t/datareader-error-parsing-data-that-contains-double-quotes/434/4 "2008-11-18T07:49:01Z")

</div>

What about setting **“,”** as delimiter and stripping quotation in Reformat?

---

<div class="post-metadata">

**Author:** ![achan](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@achan](https://forum.cloverdx.com/u/achan)\
**Post date:** [November 18, 2008, 11:09pm UTC](https://forum.cloverdx.com/t/datareader-error-parsing-data-that-contains-double-quotes/434/5 "2008-11-18T23:09:04Z")

</div>

Hi Agata,

setting “,” as delimiter would not work if my numeric fields are non-quoted, right?

say my data is:

“ref”,“buyer”,“amount”  
“10,00-1"“a”,“albert”,10  
“10,00-2”'b”,“tony”,20

i will still have a problem with reading the data in “amount” field…

any other suggestions?

Thanks,  
al

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [November 19, 2008, 10:53am UTC](https://forum.cloverdx.com/t/datareader-error-parsing-data-that-contains-double-quotes/434/6 "2008-11-19T10:53:04Z")

</div>

Hi,  
my last idea is to set default delimiter as **“,”** and for numeric fields only **,** and for string fields before numeric field **",** ; something like that:

```auto
<Record fieldDelimiter="&quot;,&quot;" name="quotedData" recordDelimiter="\n" type="delimited">
<Field name="field1" type="string"/>
<Field delimiter="&quot;," name="field2" type="string"/>
<Field delimiter="," name="field3" type="numeric"/>
<Field name="field4" type="string"/>
</Record>

```

---

<div class="post-metadata">

**Author:** ![achan](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@achan](https://forum.cloverdx.com/u/achan)\
**Post date:** [November 19, 2008, 5:34pm UTC](https://forum.cloverdx.com/t/datareader-error-parsing-data-that-contains-double-quotes/434/7 "2008-11-19T17:34:02Z")

</div>

Hi Agata,

your suggestions would all be good if there is a strict format for the data…

for my case, setting individual field delimiter would not work if the data i am getting can have these possibilities:

1. for numeric fields, they can be quoted or unquoted… e.g “200” or 200…  
2. for string fields, they might contain a embedded quotes or embedded comma (which is also my field delimiter)… e.g “abc"def” or “abc’def” or “abcdef” or “abc,def”

is my only option read the each record as 1 big field and parse it myself??

Thanks,  
al

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [November 20, 2008, 8:08am UTC](https://forum.cloverdx.com/t/datareader-error-parsing-data-that-contains-double-quotes/434/8 "2008-11-20T08:08:39Z")

</div>

Hi,  
we talked about it in our development team and conceded, that there couldn’t be universal parser for such data.  
If you don’t have strict format, you have to parse it yourself ☹

---

<div class="post-metadata">

**Author:** ![achan](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@achan](https://forum.cloverdx.com/u/achan)\
**Post date:** [November 20, 2008, 4:53pm UTC](https://forum.cloverdx.com/t/datareader-error-parsing-data-that-contains-double-quotes/434/9 "2008-11-20T16:53:08Z")

</div>

Hi Agata,

Ok. I will parse it.

Thanks for all your suggestions.

al
