<s> """<STR_LIT>""" <EOL> import csv <EOL> import codecs <EOL> class UTF8Recoder : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , f , encoding ) : <EOL> self . reader = codecs . getreader ( encoding ) ( f ) <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def next ( self ) : <EOL> return self . reader . next ( ) . strip ( ) . encode ( "<STR_LIT:utf-8>" ) <EOL> class UnicodeReader : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , f , dialect = csv . excel , encoding = "<STR_LIT:utf-8>" , ** kwds ) : <EOL> f = UTF8Recoder ( f , encoding ) <EOL> self . reader = csv . reader ( f , dialect = dialect , ** kwds ) <EOL> def next ( self ) : <EOL> row = self . reader . next ( ) <EOL> return [ unicode ( s . strip ( ) , "<STR_LIT:utf-8>" ) for s in row ] <EOL> def __iter__ ( self ) : <EOL> return self </s>
