You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2016/01/19 05:38:39 UTC

[jira] [Comment Edited] (CSV-135) Char escape doesn't work

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

Gary Gregory edited comment on CSV-135 at 1/19/16 4:38 AM:
-----------------------------------------------------------

I can confirm that:

{code:java}
l.add("\\");
{code}

does not output:
{code:java}
"\\"
{code}

But instead:

does not output:
{code:java}
"\"
{code}

which causes an EOFException in the parser if you try to read it back.

But I thought that anything goes inside of quotes, which is the point of quoting...

Thoughts?



was (Author: garydgregory):
I can confirm that:

{code:java}
l.add("\\");
{code}

does not output:
{code:java}
"\\"
{code}

:-(

But instead:

does not output:
{code:java}
"\"
{code}

which causes an EOFException in the parser if you try to read it back.


> Char escape doesn't work
> ------------------------
>
>                 Key: CSV-135
>                 URL: https://issues.apache.org/jira/browse/CSV-135
>             Project: Commons CSV
>          Issue Type: Bug
>          Components: Printer
>    Affects Versions: 1.0
>            Reporter: Mateusz Zakarczemny
>             Fix For: Patch Needed
>
>
> Following code:
> {code}
> CSVFormat format = CSVFormat.DEFAULT
> 	.withRecordSeparator('\n')
> 	.withQuote('"')
> 	.withEscape('\\');
> CSVPrinter printer = new CSVPrinter(System.out, format);
> List<String> l = new LinkedList<String>();
> l.add("\"");
> l.add("\n");
> l.add("\\");
> printer.printRecord(l);
> {code}
> produces
> {code}
> """","
> ","\"
> {code}
> instead of
> {code}
> "\"","\n","\\"
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)