forked from CGM_Public/pretix_original
Banktransfer: CSV import of Mac CSV files
This commit is contained in:
@@ -46,6 +46,10 @@ def get_rows_from_file(file):
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
charset = file.charset
|
charset = file.charset
|
||||||
data = data.decode(charset or 'utf-8')
|
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
|
# 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.
|
# one-column garbage at the beginning of the file which breaks the sniffer.
|
||||||
# See also: http://bugs.python.org/issue2078
|
# See also: http://bugs.python.org/issue2078
|
||||||
|
|||||||
Reference in New Issue
Block a user