emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: "Łukasz Stelmach" <lukasz.stelmach@iem.pw.edu.pl>,
	nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: [PATCH] quote the real csv separator
Date: Sun, 24 Oct 2010 12:52:55 -0400	[thread overview]
Message-ID: <12945.1287939175@gamaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Carsten Dominik <carsten.dominik@gmail.com> of "Sun, 24 Oct 2010 18:26:40 +0200." <57E157F5-BDE7-4431-B15F-8EE52E571677@gmail.com>

Carsten Dominik <carsten.dominik@gmail.com> wrote:

> Hi Lukasz,
> 
> thanks for the patch, but I do not understand it.
> 
> The separator for csv is always the comma, or am I wrong here?
> So this function should use comma, hard-coded.  The only place
> where it is used is when orgtbl-to-csv calls the generic
> exporter.  It does so with comma as separator and with
> org-quote-csv-field as formatting function.
> 
> What use case do you have in mind?
> 
> - Carsten
> 

[This is *not* a comment on the patch itself, which I have not looked at
carefully.]

CSV started out simple and grew to be a monster (but it is still useful
despite all that). It's not formally defined, so there are several
variations, dialects and subdialects.  Here e.g. is the description of
the python module that handles CSV: it defines an "excel" dialect and an
"excel_tab" subdialect, the latter using a TAB as a delimiter. If you
want more details and have python installed, start it up, import csv and
then say "help(csv)".

HTH,
Nick

,----
| NAME
|     csv - CSV parsing and writing.
| 
| FILE
|     /usr/lib/python2.5/csv.py
| 
| MODULE DOCS
|     http://www.python.org/doc/current/lib/module-csv.html
| 
| DESCRIPTION
|     This module provides classes that assist in the reading and writing
|     of Comma Separated Value (CSV) files, and implements the interface
|     described by PEP 305.  Although many CSV files are simple to parse,
|     the format is not formally defined by a stable specification and
|     is subtle enough that parsing lines of a CSV file with something
|     like line.split(",") is bound to fail.  The module supports three
|     basic APIs: reading, writing, and registration of dialects.
|     
|     
|     DIALECT REGISTRATION:
|     
|     Readers and writers support a dialect argument, which is a convenient
|     handle on a group of settings.  When the dialect argument is a string,
|     it identifies one of the dialects previously registered with the module.
|     If it is a class or instance, the attributes of the argument are used as
|     the settings for the reader or writer:
|     
|         class excel:
|             delimiter = ','
|             quotechar = '"'
|             escapechar = None
|             doublequote = True
|             skipinitialspace = False
|             lineterminator = '\r\n'
|             quoting = QUOTE_MINIMAL
|     
|     SETTINGS:
|     
|         * quotechar - specifies a one-character string to use as the 
|             quoting character.  It defaults to '"'.
|         * delimiter - specifies a one-character string to use as the 
|             field separator.  It defaults to ','.
|         * skipinitialspace - specifies how to interpret whitespace which
|             immediately follows a delimiter.  It defaults to False, which
|             means that whitespace immediately following a delimiter is part
|             of the following field.
|         * lineterminator -  specifies the character sequence which should 
|             terminate rows.
|         * quoting - controls when quotes should be generated by the writer.
|             It can take on any of the following module constants:
|     
|             csv.QUOTE_MINIMAL means only when required, for example, when a
|                 field contains either the quotechar or the delimiter
|             csv.QUOTE_ALL means that quotes are always placed around fields.
|             csv.QUOTE_NONNUMERIC means that quotes are always placed around
|                 fields which do not parse as integers or floating point
|                 numbers.
|             csv.QUOTE_NONE means that quotes are never placed around fields.
|         * escapechar - specifies a one-character string used to escape 
|             the delimiter when quoting is set to QUOTE_NONE.
|         * doublequote - controls the handling of quotes inside fields.  When
|             True, two consecutive quotes are interpreted as one during read,
|             and when writing, each quote character embedded in the data is
|             written as two quotes
`----

  reply	other threads:[~2010-10-24 16:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-23 22:56 [PATCH] quote the real csv separator Łukasz Stelmach
2010-10-24 16:26 ` Carsten Dominik
2010-10-24 16:52   ` Nick Dokos [this message]
2010-10-24 19:37     ` Carsten Dominik
2010-10-25 10:32     ` Stefan Vollmar
2010-10-24 20:49   ` Łukasz Stelmach
2010-10-25  1:25     ` Bernt Hansen
2010-10-25  8:45       ` Łukasz Stelmach
2010-10-25  9:06         ` Carsten Dominik
2010-10-25 11:59           ` Łukasz Stelmach
2010-10-25  9:15   ` Sébastien Vauban

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12945.1287939175@gamaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=lukasz.stelmach@iem.pw.edu.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).