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/07/31 07:24:20 UTC

[jira] [Resolved] (CSV-171) Negative numeric values in the first column are always quoted in minimal mode

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

Gary Gregory resolved CSV-171.
------------------------------
       Resolution: Fixed
    Fix Version/s: 1.5

The first char test is now per RFC4180 (https://tools.ietf.org/html/rfc4180): TEXTDATA =  %x20-21 / %x23-2B / %x2D-7E.

Please verify and fix.

> Negative numeric values in the first column are always quoted in minimal mode
> -----------------------------------------------------------------------------
>
>                 Key: CSV-171
>                 URL: https://issues.apache.org/jira/browse/CSV-171
>             Project: Commons CSV
>          Issue Type: Bug
>            Reporter: Michael Graessle
>            Priority: Minor
>             Fix For: 1.5
>
>
> Negative Numeric values are always quoted in minimal mode if (and only if) they are in the first column.
> i.e.
> long,lat,data
> "-92.222",43.333,3
> Looking at the code, this is by design but seem to be for an unknown reason.
> From v1.2 CSVPrinter line 230:
> // TODO where did this rule come from?
> if (newRecord && (c < '0' || (c > '9' && c < 'A') || (c > 'Z' && c < 'a') || (c > 'z'))) {
>     quote = true;
> } else ...
>    
> I propose this rule to either be remove or at a minimum be changed to:
> // TODO where did this rule come from?
> if (newRecord && (c !='-' && c < '0' || (c > '9' && c < 'A') || (c > 'Z' && c < 'a') || (c > 'z'))) {
>     quote = true;
> } else ...
>    



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