我有一个以UTF-8编码保存的csv文件。
它包含非ASCII字符[umlauts]。
我正在使用以下方式读取文件:
csv.DictReader(<file>,delimiter=<delimiter>).
我的问题是:
- In which encoding is the file being read?
I noticed that in order to refer to the strings as utf-8 I need to perform:
str.decode('utf-8')
Is there a better approach then reading the file in one encoding and then to convert to another, i.e.
utf-8
?
[Python版本:2.7]