about summary refs log tree commit diff stats
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
commit3f6a09f233cf12727be7405a52461dad3964dcf2 (patch)
treedfe4cf83ca786944cea335105026187f7a166fc6
parent74a470bc65b016c024fc6eb6b389cd4b3fc13767 (diff)
downloadranger-3f6a09f233cf12727be7405a52461dad3964dcf2.tar.gz
bookmarks: Force UTF-8 encoding
-rw-r--r--ranger/container/bookmarks.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py
index 74b478c7..2287cf25 100644
--- a/ranger/container/bookmarks.py
+++ b/ranger/container/bookmarks.py
@@ -176,7 +176,7 @@ class Bookmarks(FileManagerAware):
 
         path_new = self.path + '.new'
         try:
-            with open(path_new, 'w') as fobj:
+            with open(path_new, 'w', encoding="utf-8") as fobj:
                 for key, value in self.dct.items():
                     if isinstance(key, str) and key in ALLOWED_KEYS \
                             and key not in self.nonpersistent_bookmarks:
@@ -218,14 +218,14 @@ class Bookmarks(FileManagerAware):
 
         if not os.path.exists(self.path):
             try:
-                with open(self.path, 'w') as fobj:
+                with open(self.path, 'w', encoding="utf-8") as fobj:
                     pass
             except OSError as ex:
                 self.fm.notify('Bookmarks error: {0}'.format(str(ex)), bad=True)
                 return None
 
         try:
-            with open(self.path, 'r') as fobj:
+            with open(self.path, 'r', encoding="utf-8") as fobj:
                 dct = {}
                 for line in fobj:
                     if self.load_pattern.match(line):