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:02 +0200
committertoonn <toonn@toonn.io>2021-09-01 17:57:15 +0200
commit74a470bc65b016c024fc6eb6b389cd4b3fc13767 (patch)
tree0e6df6e851ea0c892ef5fb671998335c508819c7 /ranger
parentad082b831d87de2dd97d4a053a8a5e5d9ad7cc92 (diff)
downloadranger-74a470bc65b016c024fc6eb6b389cd4b3fc13767.tar.gz
commands: Force UTF-8 encoding
Diffstat (limited to 'ranger')
-rwxr-xr-xranger/config/commands.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 9c333e4a..d1d84e91 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -887,7 +887,7 @@ class load_copy_buffer(Command):
         fname = self.fm.datapath(self.copy_buffer_filename)
         unreadable = OSError if PY3 else IOError
         try:
-            with open(fname, "r") as fobj:
+            with open(fname, "r", encoding="utf-8") as fobj:
                 self.fm.copy_buffer = set(
                     File(g) for g in fobj.read().split("\n") if exists(g)
                 )
@@ -911,7 +911,7 @@ class save_copy_buffer(Command):
         fname = self.fm.datapath(self.copy_buffer_filename)
         unwritable = OSError if PY3 else IOError
         try:
-            with open(fname, "w") as fobj:
+            with open(fname, "w", encoding="utf-8") as fobj:
                 fobj.write("\n".join(fobj.path for fobj in self.fm.copy_buffer))
         except unwritable:
             return self.fm.notify("Cannot open %s" %
@@ -963,7 +963,7 @@ class touch(Command):
         if not lexists(fname):
             if not lexists(dirname):
                 makedirs(dirname)
-            with open(fname, 'a'):
+            with open(fname, 'a', encoding="utf-8"):
                 pass  # Just create the file
         else:
             self.fm.notify("file/directory exists!", bad=True)