When writing in utf8, also read in utf8

This commit is contained in:
Tomas Groth 2015-03-06 09:35:47 +01:00
parent 84a0fa0ecd
commit 0777a5cb90

View File

@ -306,7 +306,7 @@ class PresentationDocument(object):
titles_file = os.path.join(self.get_thumbnail_folder(), 'titles.txt') titles_file = os.path.join(self.get_thumbnail_folder(), 'titles.txt')
if os.path.exists(titles_file): if os.path.exists(titles_file):
try: try:
with open(titles_file) as fi: with open(titles_file, encoding='utf-8') as fi:
titles = fi.read().splitlines() titles = fi.read().splitlines()
except: except:
log.exception('Failed to open/read existing titles file') log.exception('Failed to open/read existing titles file')
@ -316,7 +316,7 @@ class PresentationDocument(object):
note = '' note = ''
if os.path.exists(notes_file): if os.path.exists(notes_file):
try: try:
with open(notes_file) as fn: with open(notes_file, encoding='utf-8') as fn:
note = fn.read() note = fn.read()
except: except:
log.exception('Failed to open/read notes file') log.exception('Failed to open/read notes file')