mjumbewu / django-rest-framework-csv

CSV Tools for Django REST Framework
BSD 2-Clause "Simplified" License
364 stars 89 forks source link

line breaks inside quoted fields are lost #24

Open amc1804 opened 9 years ago

amc1804 commented 9 years ago

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.