[ 
https://issues.apache.org/jira/browse/NIFI-6745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16952578#comment-16952578
 ] 

N commented on NIFI-6745:
-------------------------

an example:

im using the ConvertRecord Proccesor 
its record reader is CSVReader 

its record writer AvroRecordSetWriter

the problem i had is that the controller service CSVReader had a '\' as an 
escape character but csv already has "" as an escape character
we have changed it and it solved our problem.

however, we were not able to *disable the option* *to have an escape 
character*, does it really need an escape character if CSV already has one?

an example for a faling CSV: (escape character is '\'):
id,data

1, "\{"This will pass" : ""data""}"

2, "\{"This will fail" : ""da\""ta""}"

> No possiblity to set empty string as escape character
> -----------------------------------------------------
>
>                 Key: NIFI-6745
>                 URL: https://issues.apache.org/jira/browse/NIFI-6745
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.9.2
>            Reporter: N
>            Priority: Trivial
>
> In a traditional csv parser like excel if you want to include a comma in a 
> field you encapsulated it with quotes ("foo,bar") and if you need quotes 
> between those quotes you add another pair of quotes before it ( "she 
> said:""foo""" )
> however, in your csv parser there is another rule which says that '\' is a 
> classic escape char and you can't disable it, this is a problematic rule 
> because:
> If you have a csv which contains a JSON as a string inside one of his fields 
> like (1,test,"\{""foo"":""bar""}") and you want to add a ' " ' inside it you 
> need to add a ' \' before it(1,test,"\{""foo"":""b\""r""}") because you need 
> to escape the " for the JSON parser, but in your csv parser this example will 
> fail becuse it will be parsed to "\{""foo"":""b"r""}")" which is invalid ( 
> the exemple sould become \{"foo":"b/"r"} ) .
> In order to fix this adding the optoin to disable the escape char in the csv 
> parser will fix this problem.
> And by the way why is there an escape char in a csv parser any ways?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to