@@ -850,25 +850,27 @@ def __iter__(self):
850
850
def next (self ):
851
851
return self .reader .next ().encode ("utf-8" )
852
852
853
- class UnicodeReader :
854
- """
855
- A CSV reader which will iterate over lines in the CSV file "f",
856
- which is encoded in the given encoding.
857
-
858
- On Python 3, this is replaced (below) by csv.reader, which handles unicode.
859
- """
860
-
861
- def __init__ (self , f , dialect = csv .excel , encoding = "utf-8" , ** kwds ):
862
- f = UTF8Recoder (f , encoding )
863
- self .reader = csv .reader (f , dialect = dialect , ** kwds )
853
+ if py3compat .PY3 : # pragma: no cover
854
+ def UnicodeReader (f , dialect = csv .excel , encoding = "utf-8" , ** kwds ):
855
+ # ignore encoding
856
+ return csv .reader (f , dialect = csv .excel , ** kwds )
857
+ else :
858
+ class UnicodeReader :
859
+ """
860
+ A CSV reader which will iterate over lines in the CSV file "f",
861
+ which is encoded in the given encoding.
864
862
865
- def next ( self ):
866
- row = self . reader . next ()
867
- return [ unicode ( s , "utf-8" ) for s in row ]
863
+ On Python 3, this is replaced (below) by csv.reader, which handles
864
+ unicode.
865
+ """
868
866
869
- def __iter__ (self ): # pragma: no cover
870
- return self
867
+ def __init__ (self , f , dialect = csv .excel , encoding = "utf-8" , ** kwds ):
868
+ f = UTF8Recoder (f , encoding )
869
+ self .reader = csv .reader (f , dialect = dialect , ** kwds )
871
870
872
- if py3compat .PY3 : # pragma: no cover
873
- UnicodeReader = csv .reader
871
+ def next (self ):
872
+ row = self .reader .next ()
873
+ return [unicode (s , "utf-8" ) for s in row ]
874
874
875
+ def __iter__ (self ): # pragma: no cover
876
+ return self
0 commit comments