Banktransfer: CSV import of Mac CSV files

This commit is contained in:
Raphael Michel
2019-03-11 14:30:43 +01:00
parent 4e3dd24209
commit 13ee691133

View File

@@ -46,6 +46,10 @@ def get_rows_from_file(file):
except ImportError:
charset = file.charset
data = data.decode(charset or 'utf-8')
# If the file was modified on a Mac, it only contains \r as line breaks
if '\r' in data and '\n' not in data:
data = data.replace('\r', '\n')
# Sniffing line by line is necessary as some banks like to include
# one-column garbage at the beginning of the file which breaks the sniffer.
# See also: http://bugs.python.org/issue2078