Commit: runtime(netrw): Decode multibyte percent-encoding filename correctly (#13842)

5 views
Skip to first unread message

Christian Brabandt

unread,
Jan 12, 2024, 11:30:14 AM1/12/24
to vim...@googlegroups.com
runtime(netrw): Decode multibyte percent-encoding filename correctly (#13842)

Commit: https://github.com/vim/vim/commit/2357765304e4c55935b5cc853ffb98ae82d64a01
Author: K.Takata <ken...@csc.jp>
Date: Sat Jan 13 01:30:01 2024 +0900

runtime(netrw): Decode multibyte percent-encoding filename correctly (https://github.com/vim/vim/issues/13842)

Use `printf("%c")` instead of `nr2char()` to handle '%xx' as a byte.

Close #13787

Signed-off-by: Ken Takata <ken...@csc.jp>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index 3af7ba0f1..bcb1f2475 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -11587,7 +11587,7 @@ endfun
" netrw#RFC2396: converts %xx into characters {{{2
fun! netrw#RFC2396(fname)
" call Dfunc("netrw#RFC2396(fname<".a:fname.">)")
- let fname = escape(substitute(a:fname,'%\(\x\x\)','\=nr2char("0x".submatch(1))','ge')," ")
+ let fname = escape(substitute(a:fname,'%\(\x\x\)','\=printf("%c","0x".submatch(1))','ge')," ")
" call Dret("netrw#RFC2396 ".fname)
return fname
endfun
Reply all
Reply to author
Forward
0 new messages