I\'m getting a
UnicodeEncodeError: \'ascii\' codec can\'t encode character u\'\\xa3\' in position 34: ordinal not in range(128)
on a strin
You can also encode your string as utf-8 manually before adding it to the StringIO
for val in rows: if isinstance(val, unicode): val = val.encode('utf-8') result.writelines(rows)