Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] [RESOLVED] Re: What's the easiest way to edit EUC-JP files on a remote server from an Ubun



Edmund Edgar <lists@example.com> wrote:
> On Tue, 15 Sep 2020 at 15:44, <eizietheez@example.com> wrote:
> > Is there any reason the `fileencodings' setting doesn't work for you?
> > $ vim --cmd 'set fileencodings=euc-jp' euc-jp-encoded-file.txt
> 
> That works fine if the file is local, but it's on a remote server that I'm
> ssh'ing to.

vim is capable of doing on-the-fly translation between file and
terminal encodings.  Possibly the remote host has different defaults /
remote vim picks a different encoding to work as, causing it to behave
differently from your local vim.

Try setting your local terminal encoding to UTF-8 and use these settings
on the remote host .vimrc and see if you can edit a EUC-JP (or
Shift-JIS, or UTF-8, etc) file with them.

:set encoding=utf-8
:set fileencodings=iso-2022-jp,euc-jp,sjis,utf-8
:set fileformats=unix,dos,mac

Reference: https://itcweb.cc.affrc.go.jp/affrit/faq/tips/vim-enc

The details are hairy.  e.g. I'm not sure how locale (in the
environment and in vim) interacts with the above, and there's a
"termencoding" option etc.  Check the manual if you are interested.

https://vimhelp.org/usr_45.txt.html
https://vimhelp.org/mbyte.txt.html

-- 
Stephen Lee <sl-tlug@example.com>


Home | Main Index | Thread Index