;examples: test files for CSV encoding [#2319]
This commit is contained in:
parent
5114962b2a
commit
cdf6ce072d
@ -1,3 +1,4 @@
|
||||
"Date","Note","Amount"
|
||||
"2012/3/22","DEPOSIT","50.00"
|
||||
"2012/3/23","TRANSFER TO SAVINGS","-10.00"
|
||||
"2012/3/24","COFFEE — €20 RECEIVED","-20.00"
|
||||
|
||||
|
2
examples/sample.csv.cp1252.rules
Normal file
2
examples/sample.csv.cp1252.rules
Normal file
@ -0,0 +1,2 @@
|
||||
include sample.csv.rules
|
||||
encoding cp1252
|
||||
2
examples/sample.csv.iso88591.rules
Normal file
2
examples/sample.csv.iso88591.rules
Normal file
@ -0,0 +1,2 @@
|
||||
include sample.csv.rules
|
||||
encoding iso8859-1
|
||||
4
examples/sample.fr.cp1252.csv
Normal file
4
examples/sample.fr.cp1252.csv
Normal file
@ -0,0 +1,4 @@
|
||||
"Date","Remarque","Montant"
|
||||
"2012/3/22","DÉPÔT","50.00"
|
||||
"2012/3/23","VIREMENT VERS ÉPARGNE","-10.00"
|
||||
"2012/3/24","CAFÉ — €20 REÇU","-20.00"
|
||||
|
16
examples/sample.fr.csv.py
Normal file
16
examples/sample.fr.csv.py
Normal file
@ -0,0 +1,16 @@
|
||||
text = '''"Date","Remarque","Montant"
|
||||
"2012/3/22","DÉPÔT","50.00"
|
||||
"2012/3/23","VIREMENT VERS ÉPARGNE","-10.00"
|
||||
"2012/3/24","CAFÉ — €20 REÇU","-20.00"'''
|
||||
|
||||
# Create UTF-8 file
|
||||
with open('sample-fr.utf8.csv', 'wb') as f:
|
||||
f.write(text.encode('utf-8'))
|
||||
|
||||
# Create ISO-8859-1 file, replacing unsupported characters
|
||||
with open('sample-fr.iso8859-1.csv', 'wb') as f:
|
||||
f.write(text.encode('iso-8859-1', errors='replace'))
|
||||
|
||||
# Create Windows-1252 file
|
||||
with open('sample-fr.cp1252.csv', 'wb') as f:
|
||||
f.write(text.encode('cp1252', errors='replace'))
|
||||
4
examples/sample.fr.iso88591.csv
Normal file
4
examples/sample.fr.iso88591.csv
Normal file
@ -0,0 +1,4 @@
|
||||
"Date","Remarque","Montant"
|
||||
"2012/3/22","DÉPÔT","50.00"
|
||||
"2012/3/23","VIREMENT VERS ÉPARGNE","-10.00"
|
||||
"2012/3/24","CAFÉ ? ?20 REÇU","-20.00"
|
||||
|
4
examples/sample.fr.utf8.csv
Normal file
4
examples/sample.fr.utf8.csv
Normal file
@ -0,0 +1,4 @@
|
||||
"Date","Remarque","Montant"
|
||||
"2012/3/22","DÉPÔT","50.00"
|
||||
"2012/3/23","VIREMENT VERS ÉPARGNE","-10.00"
|
||||
"2012/3/24","CAFÉ — €20 REÇU","-20.00"
|
||||
|
Loading…
Reference in New Issue
Block a user