django-rest-framework-csv icon indicating copy to clipboard operation
django-rest-framework-csv copied to clipboard

line breaks inside quoted fields are lost

Open amc1804 opened this issue 10 years ago • 0 comments

When the CSV input contains line breaks inside quoted fields, like so:

c1,c2 foo,"bar baz"

the parser drops the interior line breaks, yielding

{ 'c1': 'foo', 'c2': 'barbaz' }

rather than the expected

{ 'c1': 'foo', 'c2': 'bar\r\nbaz' }

That's with Python 2.7.6, REST Framework 2.4.3, and Django 1.5.8 on Linux.

I was able to fix this by changing splitlines() to splitlines(True) in parsers.py.

amc1804 avatar Dec 05 '14 10:12 amc1804