Monday, January 21, 2013

Re: How to run shell commands containing non-ascii characters from Vim

Hi,

av wrote:
> This is what I tried:
>
> For french this works:
>
> echo system('chcp 850 & type "' . iconv('c:\temp\été2012.txt', &enc, 'latin1') . '"')
>
> Even simply this works without the chcp (probably because my shell is
> cp850 by default):
>
> echo system('type "' . iconv('c:\temp\été2012.txt', &enc, 'latin1') . '"')
>
> I tried also but it didn't worked:
>
> echo system('type "' . iconv('c:\temp\été2012.txt', &enc, 'cp850') . '"')
>
> For russian dosen't work althought it seems it should work, here the
> shell encoding is changed to russian, and vim's utf-8 is changed to
> russian 855:
>
> echo system('chcp 855 & type "' . iconv('c:\temp\Copy of Новый текстовый документ.txt', &enc, 'cp855') . '"')
>
> I tried also with 866 which is for russian also:
>
> echo system('chcp 866 & type "' . iconv('c:\temp\Copy of Новый текстовый документ.txt', &enc, 'cp866') . '"')
>
> I tried also with koi8-r without success
>
> echo system('chcp 855 & type "' . iconv('c:\temp\Copy of Новый текстовый документ.txt', &enc, 'koi8-r') . '"')
> echo system('chcp 866 & type "' . iconv('c:\temp\Copy of Новый текстовый документ.txt', &enc, 'koi8-r') . '"')

for testing purposes you might want to use a simple batch file instead
of the type command so you can see which file name is actually seen by
the shell:

@echo off
chcp
echo File name is %1
pause

Save this batch as type2.bat und change all instances of "type" in your
tests to "type2.bat".

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: