about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2021-08-27 20:07:37 +0200
committertoonn <toonn@toonn.io>2021-08-27 20:08:42 +0200
commit512ffcc81aca3314e86d49537656cd569f39c619 (patch)
treec585807bc25eb6d5ac56b3eb6599eba8e2b30a6a /ranger
parent0156b1a9ea31df6335c2f1f7ead57ad2afd741d5 (diff)
downloadranger-512ffcc81aca3314e86d49537656cd569f39c619.tar.gz
bookmarks: Switch to open23, forcing UTF-8
Diffstat (limited to 'ranger')
-rw-r--r--ranger/container/bookmarks.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py
index 8d269df8..4407477e 100644
--- a/ranger/container/bookmarks.py
+++ b/ranger/container/bookmarks.py
@@ -8,6 +8,7 @@ import re
 import os
 
 from ranger.core.shared import FileManagerAware
+from ranger.ext.open23 import open23
 
 ALLOWED_KEYS = string.ascii_letters + string.digits + "`'"
 
@@ -175,7 +176,7 @@ class Bookmarks(FileManagerAware):
 
         path_new = self.path + '.new'
         try:
-            with open(path_new, 'w') as fobj:
+            with open23(path_new, 'w') 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:
@@ -217,14 +218,14 @@ class Bookmarks(FileManagerAware):
 
         if not os.path.exists(self.path):
             try:
-                with open(self.path, 'w') as fobj:
+                with open23(self.path, 'w') 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 open23(self.path, 'r') as fobj:
                 dct = {}
                 for line in fobj:
                     if self.load_pattern.match(line):