I have an html file which is shift-JIS encoded (Japanese), and I cannot read it under vim. Setting enc=cp932 or enc=sjis generates garbage. The file looks fine in emacs, so I guess this is vim specific. What can I do to read it as is (besides converting it to a sane encoding like utf-8).
You should not ever want to change encoding
option: it is for internal representation of strings and should be changed only if current encoding does not contain characters present in desired encoding. If you sometimes edit files with sjis
encoding, then
Be sure, that fileencodings
option contains sjis
: put something like that into vimrc
:
set fileencodings=ucs-bom,utf-8,sjis,default
e ++enc=sjis /path/to/file
. Or, if file is already opened, use e! ++enc=sjis
(without filename).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With