Skip to content

Commit ae9af7e

Browse files
committed
Add UTF-8 encoding for retrieving text from files
1 parent 4a3ae69 commit ae9af7e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

diskcache/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ def fetch(self, directory, mode, filename, value, read):
234234
with io.open(op.join(directory, filename), 'rb') as reader:
235235
return reader.read()
236236
elif mode == MODE_TEXT:
237-
with io.open(op.join(directory, filename), 'rt') as reader:
237+
full_path = op.join(directory, filename)
238+
with io.open(full_path, 'r', encoding='UTF-8') as reader:
238239
return reader.read()
239240
elif mode == MODE_PICKLE:
240241
if value is None:

0 commit comments

Comments
 (0)