UnicodeDecodeError in CSV writer in Python
I faced another error with UnicodeWriter class. Now it's UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 21: ordinal not in range(128) . More details: Traceback (most recent call last): File "cpx_parser.py", line 284, in main() File "cpx_parser.py", line 278, in main writer.writerow(csv_li) File "cpx_parser.py", line 29, in writerow self.writer.writerow([s.encode("utf-8") for s in row]) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 21: ordinal not in range(128) So, I had to decode s using utf-8, then convert it into unicode. And that solved the problem. Here is what I did: self.writer.writerow([unicode(s.decode("utf-8")).encode("utf-8") for s in row]) To know more about unicode, you can check this link .