commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CSV-54) Confusing semantic of the ignore leading/trailing spaces parameters
Date Mon, 12 Mar 2012 14:00:40 GMT

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

Emmanuel Bourg commented on CSV-54:
-----------------------------------

I suggest replacing {{leading/trailingSpacesIgnored}} with two parameters:
- {{interleavedSpacesIgnored}}: this will ignore the spaces between the delimiter and the
opening quote, and between the closing quote and the next delimiter.
- {{trimmedSpaces}}: this will remove the spaces around the values, on the left and on the
right. I don't see the need to trim only on one side and not the other.

                
> Confusing semantic of the ignore leading/trailing spaces parameters
> -------------------------------------------------------------------
>
>                 Key: CSV-54
>                 URL: https://issues.apache.org/jira/browse/CSV-54
>             Project: Commons CSV
>          Issue Type: Bug
>          Components: Parser
>            Reporter: Emmanuel Bourg
>             Fix For: 1.0
>
>
> {{CSVFormat}} has two parameters to control how the leading and trailing spaces around
values are handled, but the actual behavior depends on the value being enclosed in quotes
or not.
> If the value is not enclosed in quotes, setting {{leading/trailingSpacesIgnored}} to
{{true}} will left or right trim the value. For example with this input (using the default
format):
> {code}a,  b  ,c{code}
> the second value will be equal to {{'b'}}.
> But if the value is enclosed into quotes, the value is no longer trimmed:
> {code}a," b ",c{code}
> this will give {{' b '}}.
> With quoted values the parser actually ignores the spaces between the delimiter and the
quote. Thus with this input:
> {code}a, " b " ,c{code}
> The value returned is {{' b '}}.
> If {{leading/trailingSpacesIgnored}} is set to {{false}}, we get instead {{' " b " '}}
which is consistent with RFC 4180.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message