Ken Takata wrote:

> 2016/8/9 Tue 5:27:12 UTC+9 Bram Moolenaar wrote:
> > Ken Takata wrote:
> > 
> > > 2016/8/6 Sat 22:30:05 UTC+9 Bram Moolenaar wrote:
> > > > Ken Takata wrote:
> > > > 
> > > > > When process substitution (e.g. "<(cmd)") is used on bash (or zsh), 
> > > > > file
> > > > > encoding detection doesn't work, and an empty buffer is opened.
> > > > > E.g.:
> > > > > 
> > > > >   $ vim -u NONE --cmd "set fencs=cp932,utf-8" <(echo テスト)
> > > > >   # Assuming the system encoding is utf-8.
> > > > > 
> > > > > Vim will be executed with the command line like:
> > > > > 
> > > > >   $ vim -u NONE --cmd "set fencs=cp932,utf-8" /dev/fd/63
> > > > > 
> > > > > "/dev/fd/63" is a fifo and it is not seekable.
> > > > > The echoed string "テスト" (utf-8) cannot be converted from cp932 to 
> > > > > utf-8, so
> > > > > Vim retries with utf-8, but it fails because the input is not 
> > > > > seekable.
> > > > > 
> > > > > However reading from stdin can detect the encoding. E.g.:
> > > > > 
> > > > >   $ echo テスト | vim -u NONE --cmd "set fencs=cp932,utf-8" -
> > > > > 
> > > > > I think file encoding detection should also work with process 
> > > > > substitution.
> > > > > Attached patch fixes the problem.
> > > > 
> > > > Thanks.  It would be good to have a test for this.  The encoding
> > > > detection is important, but I don't think there is a test for it.
> > > > 
> > > > Reading from stdin and fifo require starting Vim.  Test49 does this, it
> > > > just uses ../vim for that.  That doesn't work on Windows though.  But
> > > > the fifo won't work on Windows either.
> > > 
> > > I added a test for this. I also wanted to add a test for stdin on Windows,
> > > but Windows' echo command cannot write Unicode characters to a pipe. So 
> > > the
> > > test is disabled on Windows.
> > 
> > Thanks.  It would be better to use "cat" instead of "echo".  Does this
> > also exist on MS-Windows?  Or perhaps we can check if it exists.
> > Then we can also use multiple lines in the test.
> 
> OK, "type" can be used on Windows.
> Please check the attached patch.  

Thanks.  Glad you could make it work.  I verified that without your
patch the utf8 fifo test fails.

-- 
Normal people believe that if it ain't broke, don't fix it.  Engineers believe
that if it ain't broke, it doesn't have enough features yet.
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui