[issue39876] csv.DictReader.fieldnames interprets unicode as ascii

2020-03-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: csv.DictReader does not work with encodings. It works with already decoded strings. You have to specify the correct encoding in open() (and "t" in mode is ignored): with open(filename, "r", encoding="utf-8") as csvfile: By default open() uses locale

[issue39876] csv.DictReader.fieldnames interprets unicode as ascii

2020-03-06 Thread Andreas Spar
New submission from Andreas Spar : with open(filename, "rt") as csvfile: csv_reader = csv.DictReader(csvfile, delimiter=csv_delimiter) filednames = csv_reader.fieldnames In Python 3.8 csv expects utf-8 encoded files but apperently doens't read the header with utf-8 format. If