[New-bugs-announce] [issue1511] csv input converts \r\n to \n but csv output does not when a field has internal line breaks
Bill Fenner
report at bugs.python.org
Wed Nov 28 06:15:17 CET 2007
New submission from Bill Fenner:
When a field has internal line breaks, e.g.,
foo,"bar
baz
biff",boo
that is actually 3 lines, but one csv-file row. csv.reader() converts
this to ['foo', 'bar\nbaz\nbiff', 'boo']. This is a reasonable
behavior.
Unfortunately, csv.writer() does not use the dialect's lineterminator
setting for values with such internal linebreaks. This means that the
resulting file will have a mix of line-termination styles:
foo,"bar\n
baz\n
biff",boo\r\n
If the reading csv implementation is strict about its line termination,
these line breaks will not be read properly.
----------
messages: 57902
nosy: fenner
severity: normal
status: open
title: csv input converts \r\n to \n but csv output does not when a field has internal line breaks
type: behavior
versions: Python 2.4
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1511>
__________________________________
More information about the New-bugs-announce
mailing list