about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2019-09-30 15:46:45 +0200
committertoonn <toonn@toonn.io>2019-09-30 15:46:45 +0200
commit6ffe1183daa665e3790ad456119f7705263af3da (patch)
treec85bd791c24b4b91f3e76fcb263472ee2a59227c
parenta0e9432c4b8718fd96c25fd6f791cd477aea65cd (diff)
downloadranger-6ffe1183daa665e3790ad456119f7705263af3da.tar.gz
Switch from surrogatepass to surrogateescape
Vim (and presumably other editors) can't render the mixed utf-8 with
utf-16 surrogates text properly.
-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 3496e28c..d1e4bdbc 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -1078,11 +1078,11 @@ class bulkrename(Command):
             listpath = listfile.name
             if py3:
                 listfile.write("\n".join(filenames).encode(
-                    encoding="utf-8", errors="surrogatepass"))
+                    encoding="utf-8", errors="surrogateescape"))
             else:
                 listfile.write("\n".join(filenames))
         self.fm.execute_file([File(listpath)], app='editor')
-        with (open(listpath, 'r', encoding="utf-8", errors="surrogatepass") if
+        with (open(listpath, 'r', encoding="utf-8", errors="surrogateescape") if
               py3 else open(listpath, 'r')) as listfile:
             new_filenames = listfile.readlines()
         os.unlink(listpath)
@@ -1112,7 +1112,7 @@ class bulkrename(Command):
             script_content = "\n".join(script_lines) + "\n"
             if py3:
                 cmdfile.write(script_content.encode(encoding="utf-8",
-                                                    errors="surrogatepass"))
+                                                    errors="surrogateescape"))
             else:
                 cmdfile.write(script_content)
             cmdfile.flush()