Skip to content
This repository has been archived by the owner on Jun 7, 2020. It is now read-only.

Commit

Permalink
Fix read/write files with utf-8 - #25
Browse files Browse the repository at this point in the history
  • Loading branch information
SonyPony committed Nov 21, 2017
1 parent c43e3e9 commit 165cd22
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ifj2017/ide/core/file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ def write(self, content: str) -> None:
if not self._source:
return

with open(self._source, "w") as f:
f.write(content)
with open(self._source, "wb") as f:
f.write(bytes(content, encoding='utf-8'))

@pyqtSlot(result=str)
def read(self) -> str:
if not self._source:
return ""

with open(self._source, "r") as f:
with open(self._source, "rb") as f:
read_data = f.read()
return read_data
return str(read_data, encoding='utf-8')

0 comments on commit 165cd22

Please sign in to comment.