The Python 2.7 csv
module doesn’t support Unicode input: see the note at the beginning of the documentation.
It seems that you’ll have to encode the Unicode strings to byte strings, and use io.BytesIO
, instead of io.StringIO
.
The examples section of the documentation includes examples for a UnicodeReader
and UnicodeWriter
wrapper classes (thanks @AlexeyKachayev for the pointer).