LoginSignup
198
180

More than 5 years have passed since last update.

vimで文字化けした時の対応

Posted at

文字が文字化けした場合

・vimの文字コードを確認
:set enc?
・ファイルの文字コードを確認
:set fenc?
・エンコードを指定して保存し直す
:set fenc=文字コード

設定ファイルを変更

毎回文字コードを変更するのは大変なので
vimの設定ファイルに保存しておく。

# vi ~/.vimrc
---- vi追記 ----
set encoding=utf-8
set fileencodings=iso-2022-jp,euc-jp,sjis,utf-8
set fileformats=unix,dos,mac

保存したら、設定反映
# source ~/.vimrc

198
180
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
198
180