[New-bugs-announce] [issue15927] cvs.reader does not support escaped newline when quoting=cvs.QUOTE_NONE

Kalon Mills report at bugs.python.org
Wed Sep 12 06:49:50 CEST 2012


New submission from Kalon Mills:

cvs.reader improperly prematurely ends row parsing when parsing a row with an escaped newline but with quoting turned off.  cvs.reader properly handles quoted newlines.  cvs.writer properly handles writing escaped unquoted newlines so only the reader has an issue.

Given a dialect with escapechar='\\', quoting=csv.QUOTE_NONE, lineterminator='\n':

writer.writerow(['one\nelement']) will correctly write 'one\\\nelement\n'

however pass that back into a reader and it will produce two rows: ['one\n'] ['element']

I would expect the reader to parse it correctly and return the original value of ['one\nelement']
 
I've attached a test script that exhibits the improper behavior.  It uses a dialect to set an escapechar and disable quoting.

----------
components: None
files: test_csv.py
messages: 170352
nosy: kalaxy
priority: normal
severity: normal
status: open
title: cvs.reader does not support escaped newline when quoting=cvs.QUOTE_NONE
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file27177/test_csv.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15927>
_______________________________________


More information about the New-bugs-announce mailing list