Hi Ben!
On Mo, 21 Jan 2013, Ben Fritz wrote:
> On Monday, January 21, 2013 6:29:10 AM UTC-6, av wrote:
> > Hi,
> >
> >
> >
> > Do you know how to run shell commands containing non-ascii characters
> >
> > from Vim?
> >
> >
> >
> > example:
> >
> >
> >
> > echo system('type myfileété2012.txt')
> >
> >
> >
> > I know that a simple "r myfileété2012.txt" would include the content
> >
> > of the file, but I gave the type command as an example, it could be
> >
> > any shell command.
> >
> >
> >
> > This command should in windows, show the content of the file called
> >
> > myfileété2012.txt but because there are accents (é), the file is not
> >
> > found. Files containing french accents and russian alphabet cannot be
> >
> > run from vim shell commands.
> >
> >
> >
> > thank you very much,
> >
> >
> >
> > Alexandre
>
> Probably your 'encoding' option does not match the filesystem encoding. For example, my Vim uses utf-8 for 'encoding' but filenames on my system appear to be in Latin1.
>
> I thought 'termencoding' would handle the necessary conversion, but it actually does nothing of the sort. I'm not sure if there is a more elegant way to do this, but the following works for me:
>
> :echo system(iconv('type äbcdé.txt', 'utf-8', 'latin1'))
>
> See :help iconv() for details.
>
> Does anybody know of a better way to get Vim to properly translate between encodings before invoking the shell?
The todo list mentions several issues with encoding on win32. There was
even a patch posted on vim-dev some time ago, that should take care of
this (search for systemencoding).
Mit freundlichen Grüßen
Christian
--
Das Individuelle entscheidet überall. Wie wenig kann jeder vom besten
Helden brauchen! - Der Dichter gibt überall nur sittliche Momente, die
jeder anwende!
-- Jean Paul
--
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
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment