summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2019-09-26 11:51:12 +0200
committertoonn <toonn@toonn.io>2019-09-26 11:51:12 +0200
commit4a2281cb2595413a04c82ca9b9725cf22cee90d6 (patch)
treeaab633cc16a59499f48551af121ce450e7472af2 /ranger
parentfcb01c2c941b8a199627f99173eb31925a30ce47 (diff)
downloadranger-4a2281cb2595413a04c82ca9b9725cf22cee90d6.tar.gz
Pass surrogates when listing files for bulkrename
Surrogates aren't allowed in the UTF-8 encoding but filenames can
contain any bytes. We need to pass the surrogates literally because
otherwise `mv` won't be renaming the right files.
Diffstat (limited to 'ranger')
-rwxr-xr-xranger/config/commands.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 55dd9cd1..94921f8b 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -1078,7 +1078,8 @@ class bulkrename(Command):
         listpath = listfile.name
 
         if py3:
-            listfile.write("\n".join(filenames).encode("utf-8"))
+            listfile.write("\n".join(filenames).encode(encoding="utf-8",
+                                                       errors="surrogatepass"))
         else:
             listfile.write("\n".join(filenames))
         listfile.close()