commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Peime (JIRA)" <j...@apache.org>
Subject [jira] [Issue Comment Deleted] (CSV-135) Char escape doesn't work
Date Sat, 03 Jan 2015 13:24:34 GMT

     [ https://issues.apache.org/jira/browse/CSV-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rob Peime updated CSV-135:
--------------------------
    Comment: was deleted

(was: Not a bug.

Based upon your expected/desired output, the way you are adding values to your 
List<String> is incorrect.

Your expected output shows that you intended to have 3 values, each 2 chars 
long: a backslash followed by a quote, a backslash followed by an n, and 2 
backslashes).

But when adding values to your list, you have only added a single char for each
of the three values: a quote, a linefeed, and a forward slash.

I can confirm that escaping your input string literals give the desired output.)

> 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)

Mime
View raw message