[Vim] Easy Fixing File Encoding
I have received some files from Japanese clients and have trouble with reading it through Vim, it looks like a mess:
Check the file by
$ file -bi command, and it returns:
Fortunately, I’ve been informed that the file is encoded by Shift JIS, saved a hell lot of my time to figure out the encoding.
Shift JIS (Shift Japanese Industrial Standards, also SJIS, Shift_JIS) is a character encoding for the Japanese language, it has been replaced by CP932 for better compatibility in certain cases.
According to Vim Tips Wiki, one can reload a file using a different encoding if Vim was not able to detect the correct encoding.
So, here is the simple solution in Vim, just use
:e ++enc=sjis or