You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "tim hood (JIRA)" <ji...@apache.org> on 2015/07/21 22:13:05 UTC

[jira] [Comment Edited] (CSV-63) CSVPrinter always quotes empty string if it is the first on a line

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

tim hood edited comment on CSV-63 at 7/21/15 8:13 PM:
------------------------------------------------------

This seems to work or have I got the wrong idea.

```java
    @SuppressWarnings("static-method")
    @Test
    public void test()
    {
        try
        {
            final CSVFormat format = CSVFormat.DEFAULT.withEscape('\\').withQuoteMode(QuoteMode.NONE);

            final StringWriter out = new StringWriter();

            try (CSVPrinter printer = new CSVPrinter(out, format))
            {
                printer.printRecord(Arrays.asList(new String[] { "", "", "" }));
            }

            final String result = out.toString().trim();
            System.out.println(">>" + result + "<<");

            Assert.assertEquals(2, result.length());
        }
        catch (final IOException e)
        {
            Assert.fail(e.getMessage());
        }
    }
```



was (Author: timz):
This seems to work or have I got the wrong idea.

    @SuppressWarnings("static-method")
    @Test
    public void test()
    {
        try
        {
            final CSVFormat format = CSVFormat.DEFAULT.withEscape('\\').withQuoteMode(QuoteMode.NONE);

            final StringWriter out = new StringWriter();

            try (CSVPrinter printer = new CSVPrinter(out, format))
            {
                printer.printRecord(Arrays.asList(new String[] { "", "", "" }));
            }

            final String result = out.toString().trim();
            System.out.println(">>" + result + "<<");

            Assert.assertEquals(2, result.length());
        }
        catch (final IOException e)
        {
            Assert.fail(e.getMessage());
        }
    }



> CSVPrinter always quotes empty string if it is the first on a line
> ------------------------------------------------------------------
>
>                 Key: CSV-63
>                 URL: https://issues.apache.org/jira/browse/CSV-63
>             Project: Commons CSV
>          Issue Type: Improvement
>          Components: Printer
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: Patch Needed, 1.x
>
>
> CSVPrinter always quotes the empty string if it is the first on a line.
> This is inconsistent.



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