GVim :! The Chinese path of the Windows command line window jumped out of the% command is out of order. How to solve it?

  question, vim


To open a file in the Chinese directory, enter it in command mode as long as the current directory of GVIM is not the Chinese directory or the file name is Chinese.:! %You will jump out of this window and report an error … English file name or English path is fine.

Recently I found a good way. It was clear before that the CMD window was “cp936” and the document name from GVIM was “UTF-8”.

So, using GVIM’siconv()Function can convert “UTF-8” inside GVIM into “cp936” and send it to CMD. In this way, the previous problems can be solved.
I can use this sentence to finish at present:

:execute "!"  .iconv('"'.@%.'"','UTF-8','cp936')

A slight modification can also have other functions.

The main idea comes from:http://www.oschina.net/code/snippet_574132_13357