Skip to content

Instantly share code, notes, and snippets.

View obswork's full-sized avatar
🤙

Obssa Bizuwork obswork

🤙
View GitHub Profile
@obswork
obswork / unicode_csv.py
Created December 8, 2017 18:35 — forked from hvtuananh/unicode_csv.py
Python Unicode CSV Reader/Writer (fix writerow problem in Python docs)
#http://docs.python.org/2.7/library/csv.html
import csv, codecs, cStringIO
class UTF8Recoder:
"""
Iterator that reads an encoded stream and reencodes the input to UTF-8
"""
def __init__(self, f, encoding):
self.reader = codecs.getreader(encoding)(f)