Re: Quoted content

2019-06-14 Thread Remko Popma
Also check out https://github.com/osiegmar/FastCSV

(Shameless plug) Every java main() method deserves http://picocli.info

> On Jun 14, 2019, at 23:53, Gary Gregory  wrote:
> 
> I've never like mashing formatting and parsing options together. Should we
> have CSVFormat subclasses called CSVPrintingFormat and CSVParsingFormat?
> 
> Gary
> 
> On Fri, Jun 14, 2019 at 10:24 AM Daryl Stultz 
> wrote:
> 
>> 
>> 
>>> withIgnoreSurroundingSpaces() affects parsing
>>> withTrim() affects printing.
>> 
>> Ah, that is exactly what I needed, withIgnoreSurroundingSpaces() solves my
>> problem. (Definitely hard to understand that which applies to parsing and
>> that which applies to printing!)
>> 
>> Thank you so much.
>> 
>> /Daryl
>> 
>> 
>> 


Re: Quoted content

2019-06-14 Thread Gary Gregory
I've never like mashing formatting and parsing options together. Should we
have CSVFormat subclasses called CSVPrintingFormat and CSVParsingFormat?

Gary

On Fri, Jun 14, 2019 at 10:24 AM Daryl Stultz 
wrote:

>
>
> > withIgnoreSurroundingSpaces() affects parsing
> > withTrim() affects printing.
>
> Ah, that is exactly what I needed, withIgnoreSurroundingSpaces() solves my
> problem. (Definitely hard to understand that which applies to parsing and
> that which applies to printing!)
>
> Thank you so much.
>
> /Daryl
>
>
>


Re: Quoted content

2019-06-14 Thread sebb
I should have added:

withIgnoreSurroundingSpaces() affects parsing
withTrim() affects printing.

On Fri, 14 Jun 2019 at 15:05, sebb  wrote:
>
> Try using:
>
> withIgnoreSurroundingSpaces()
>
> On Fri, 14 Jun 2019 at 14:03, sebb  wrote:
> >
> > On Fri, 14 Jun 2019 at 13:34, Daryl Stultz  
> > wrote:
> > >
> > > I'm trying to replace an old CSV library with commons-csv. I seem to be 
> > > having trouble with the most basic idea of the parser recognizing content 
> > > that is quoted.
> > >
> > > I've discovered this bug here:
> > > https://issues.apache.org/jira/browse/CSV-228
> > >
> > > The issue refers to the 
> > > parsing of the header, but it doesn't seem to matter what row the 
> > > comma-quoting is on.
> >
> > According to my reading of RFC4180[1], the fields between delimiters
> > are either either escaped or non-escaped.
> > non-escaped fields can include spaces, but not comma
> > escaped fields must start with the double-quote; leading spaces are
> > not permitted.
> >
> > [1] https://tools.ietf.org/html/rfc4180
> >
> > > There's no way I can use this product with this defect. That's 
> > > unfortunate, I like the API and OpenCSV quotes every bit of content when 
> > > printing which I don't like.
> >
> > Now that is the case for DEFAULT and RFC4180.
> >
> > I've not looked into the withTrim() option.
> > If that is supposed to trim before handling quoted fields, then I
> > agree that there seems to be a bug here.
> > But if the trim is only supposed to apply to the un-quoted field, then
> > the current behaviour seems OK, even if it's not what you expect.
> >
> > > --
> > >
> > > Daryl Stultz
> > > Principal Software Developer
> > > _
> > > OpenTempo, Inc
> > > http://www.opentempo.com
> > > mailto:daryl.stu...@opentempo.com
> > >

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: Quoted content

2019-06-14 Thread sebb
Try using:

withIgnoreSurroundingSpaces()

On Fri, 14 Jun 2019 at 14:03, sebb  wrote:
>
> On Fri, 14 Jun 2019 at 13:34, Daryl Stultz  wrote:
> >
> > I'm trying to replace an old CSV library with commons-csv. I seem to be 
> > having trouble with the most basic idea of the parser recognizing content 
> > that is quoted.
> >
> > I've discovered this bug here:
> > https://issues.apache.org/jira/browse/CSV-228
> >
> > The issue refers to the 
> > parsing of the header, but it doesn't seem to matter what row the 
> > comma-quoting is on.
>
> According to my reading of RFC4180[1], the fields between delimiters
> are either either escaped or non-escaped.
> non-escaped fields can include spaces, but not comma
> escaped fields must start with the double-quote; leading spaces are
> not permitted.
>
> [1] https://tools.ietf.org/html/rfc4180
>
> > There's no way I can use this product with this defect. That's unfortunate, 
> > I like the API and OpenCSV quotes every bit of content when printing which 
> > I don't like.
>
> Now that is the case for DEFAULT and RFC4180.
>
> I've not looked into the withTrim() option.
> If that is supposed to trim before handling quoted fields, then I
> agree that there seems to be a bug here.
> But if the trim is only supposed to apply to the un-quoted field, then
> the current behaviour seems OK, even if it's not what you expect.
>
> > --
> >
> > Daryl Stultz
> > Principal Software Developer
> > _
> > OpenTempo, Inc
> > http://www.opentempo.com
> > mailto:daryl.stu...@opentempo.com
> >

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: Quoted content

2019-06-14 Thread sebb
On Fri, 14 Jun 2019 at 13:34, Daryl Stultz  wrote:
>
> I'm trying to replace an old CSV library with commons-csv. I seem to be 
> having trouble with the most basic idea of the parser recognizing content 
> that is quoted.
>
> I've discovered this bug here:
> https://issues.apache.org/jira/browse/CSV-228
>
> The issue refers to the 
> parsing of the header, but it doesn't seem to matter what row the 
> comma-quoting is on.

According to my reading of RFC4180[1], the fields between delimiters
are either either escaped or non-escaped.
non-escaped fields can include spaces, but not comma
escaped fields must start with the double-quote; leading spaces are
not permitted.

[1] https://tools.ietf.org/html/rfc4180

> There's no way I can use this product with this defect. That's unfortunate, I 
> like the API and OpenCSV quotes every bit of content when printing which I 
> don't like.

Now that is the case for DEFAULT and RFC4180.

I've not looked into the withTrim() option.
If that is supposed to trim before handling quoted fields, then I
agree that there seems to be a bug here.
But if the trim is only supposed to apply to the un-quoted field, then
the current behaviour seems OK, even if it's not what you expect.

> --
>
> Daryl Stultz
> Principal Software Developer
> _
> OpenTempo, Inc
> http://www.opentempo.com
> mailto:daryl.stu...@opentempo.com
>

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: Quoted content

2019-06-14 Thread Daryl Stultz
I'm trying to replace an old CSV library with commons-csv. I seem to be having 
trouble with the most basic idea of the parser recognizing content that is 
quoted.

I've discovered this bug here:
https://issues.apache.org/jira/browse/CSV-228

The issue refers to the parsing 
of the header, but it doesn't seem to matter what row the comma-quoting is on.

There's no way I can use this product with this defect. That's unfortunate, I 
like the API and OpenCSV quotes every bit of content when printing which I 
don't like.

--

Daryl Stultz
Principal Software Developer
_
OpenTempo, Inc
http://www.opentempo.com
mailto:daryl.stu...@opentempo.com