Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
in vifm by

When I use shortcut key "yp" to copy a folder's name which contains Chinese word in Windows 10, for example, "D:\bin\你好" . But it will always become "D:/bin/??",and i found the '?' character is just '63' with encoding 'ascii'.

folder's name

For generally, how can I get a correct folder's name or file's name which containing not only English word in Windows 10?

1 Answer

0 votes
by

Windows' clip seems to be very picky and will accept non-Latin input only encoded as UTF-16LE as noted here. Even pwd | clip in cmd.exe doesn't produce meaningful contents on pasting.

I found utf8clip which didn't work in my test VM, but might work for you. If it does, you can modify mappings like this:

    " Yank current directory path to Windows clipboard with forward slashes
    nnoremap yp :!pwd %i | utf8clip<cr>
    " Yank path to current file to Windows clipboard with backslashes
    nnoremap yf :.!utf8clip %i %Pl<cr>
    " Yank path to current file to Windows clipboard with forward slashes (needs sed)
    " nnoremap yf :.!sed '!\!/!' %i %Pl | utf8clip<cr>

You'll need to make utf8clip available somewhere in %PATH% (could be in $VIFM/scripts, which is added to %PATH% implicitly) or specify full path to it.

A third variant would be to find a converter from UTF-8 to UTF-16LE and use it in combination with %Pl macro. Macros like %d in echo %d seem to turn non-Latin characters to question marks as well, maybe echo does that, which is why %Pl is used.

...