From 896475350744d45f25de69c80e690fcddfad8dc2 Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 1 Sep 2021 17:53:16 +0200 Subject: console: Force UTF-8 encoding --- ranger/gui/widgets/console.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index 29c13e22..f6d3461f 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -45,7 +45,7 @@ class Console(Widget): # pylint: disable=too-many-instance-attributes,too-many- self.historypath = self.fm.datapath('history') if os.path.exists(self.historypath): try: - with open(self.historypath, "r") as fobj: + with open(self.historypath, "r", encoding="utf-8") as fobj: try: for line in fobj: self.history.add(line[:-1]) @@ -80,7 +80,7 @@ class Console(Widget): # pylint: disable=too-many-instance-attributes,too-many- return if self.historypath: try: - with open(self.historypath, 'w') as fobj: + with open(self.historypath, 'w', encoding="utf-8") as fobj: for entry in self.history_backup: try: fobj.write(entry + '\n') -- cgit 1.4.1-2-gfad0