Fix non-unicode files kill whole webide backend

This commit is contained in:
Kristóf Tóth 2018-02-08 14:13:14 +01:00
parent fc168f47ef
commit d0a04240b6

View File

@ -30,12 +30,12 @@ class FileManager:
@property
def file_contents(self):
with open(self._filepath(self.filename), 'r') as ifile:
with open(self._filepath(self.filename), 'r', errors='surrogateescape') as ifile:
return ifile.read()
@file_contents.setter
def file_contents(self, value):
with open(self._filepath(self.filename), 'w') as ofile:
with open(self._filepath(self.filename), 'w', errors='surrogateescape') as ofile:
ofile.write(value)
def _filepath(self, filename):