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

Emmanuel Bourg commented on CSV-53:
-----------------------------------

The Python CSV module has a similar concept, it offers 4 modes to control the 
quoting behavior:

http://docs.python.org/library/csv.html

{quote}
- csv.QUOTE_ALL     
  Instructs writer objects to quote all fields.

- csv.QUOTE_MINIMAL
  Instructs writer objects to only quote those fields which contain special 
characters such as delimiter, quotechar or any of the characters in 
lineterminator.

- csv.QUOTE_NONNUMERIC
  Instructs writer objects to quote all non-numeric fields.
  Instructs the reader to convert all non-quoted fields to type float.

- csv.QUOTE_NONE
  Instructs writer objects to never quote fields. When the current delimiter 
occurs in output data it is preceded by the current escapechar character. If 
escapechar is not set, the writer will raise Error if any characters that 
require escaping are encountered.
  Instructs reader to perform no special processing of quote characters.
{quote}

The idea to quote only non numeric values is interesting, I wonder if this 
helps Excel to select the right data type. However I wouldn't mix the quoting 
behavior with the escaping behavior as specified by QUOTE_NONE, this is 
probably best handled by a separate parameter.

                
> Allow to always enclose printed values into quotes
> --------------------------------------------------
>
>                 Key: CSV-53
>                 URL: https://issues.apache.org/jira/browse/CSV-53
>             Project: Commons CSV
>          Issue Type: Improvement
>          Components: Printer
>            Reporter: Emmanuel Bourg
>             Fix For: 1.x
>
>
> The printer encloses the values into quotes only if it contains a special 
> character like a field separator or a line separator. However some 
> applications expect the values to always be enclosed into quotes. It's 
> necassary to be able to control how the quotes are added, either always or as 
> needed.

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

        

Reply via email to