[issue12178] csv writer doesn't escape escapechar

Catalin Iacob report at bugs.python.org
Wed Jul 6 23:20:32 CEST 2011


Catalin Iacob <iacobcatalin at gmail.com> added the comment:

I looked at this and tried to provide a patch + tests. Please review.

The bug is that a writer can use writerow on some input data but if a reader with the same dialect reads them back they are different from the input ones. This happens when the input data contains escapechar. Contrary to msg136881, this happens regardless whether doublequote is True or False.

The docs say "On reading, the escapechar removes any special meaning from the following character". Therefore, I understand that on writing, escapechar must always be escaped by itself. If that doesn't happen, when reading it back, escapechar alters the thing that follows it instead of counting as escapechar which is precisely what this bug is about.

----------
hgrepos: +38
nosy: +catalin.iacob

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


More information about the Python-bugs-list mailing list