about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2021-09-01 17:53:15 +0200
committertoonn <toonn@toonn.io>2021-09-01 17:57:15 +0200
commit903f352beea83cc3ee9a6b62ccb735cf6b0ad02c (patch)
tree4ace6d33b4ca4a1c00322d642620174f10504a5e /ranger
parentaa4502533cd0de6b82e8fa6851ddc5b4d3a310d1 (diff)
downloadranger-903f352beea83cc3ee9a6b62ccb735cf6b0ad02c.tar.gz
fm: Force UTF-8 encoding
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/fm.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index 65a44f04..5b221648 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -441,14 +441,14 @@ class FM(Actions,  # pylint: disable=too-many-instance-attributes
             if ranger.args.choosedir and self.thisdir and self.thisdir.path:
                 # XXX: UnicodeEncodeError: 'utf-8' codec can't encode character
                 # '\udcf6' in position 42: surrogates not allowed
-                with open(ranger.args.choosedir, 'w') as fobj:
+                with open(ranger.args.choosedir, 'w', encoding="utf-8") as fobj:
                     fobj.write(self.thisdir.path)
             self.bookmarks.remember(self.thisdir)
             self.bookmarks.save()
 
             # Save tabs
             if not ranger.args.clean and self.settings.save_tabs_on_exit and len(self.tabs) > 1:
-                with open(self.datapath('tabs'), 'a') as fobj:
+                with open(self.datapath('tabs'), 'a', encoding="utf-8") as fobj:
                     # Don't save active tab since launching ranger changes the active tab
                     fobj.write('\0'.join(v.path for t, v in self.tabs.items())
                                + '\0\0')