Decode the field separator and quote char if needed.

This commit is contained in:
Khushboo Vashi 2017-11-20 16:28:13 +00:00 committed by Dave Page
parent 8cc1a007b5
commit 4568fe22f7

View File

@ -822,6 +822,18 @@ WHERE
else:
quote = csv.QUOTE_NONE
if hasattr(str, 'decode'):
# Decode the field_separator
try:
field_separator = field_separator.decode('utf-8')
except:
pass
# Decode the quote_char
try:
quote_char = quote_char.decode('utf-8')
except:
pass
csv_writer = csv.DictWriter(
res_io, fieldnames=header, delimiter=field_separator,
quoting=quote,