LoginSignup
2

More than 3 years have passed since last update.

さくらVPS CENTOS 7 文字化け対策 ロケール設定変更

Last updated at Posted at 2019-11-27

1 日本語のUTF-8に設定

[hoge@sakura ~]# localectl set-locale LANG=ja_JP.utf8

2 再読み込みさせて設定を反映

[hoge@sakura ~]# source /etc/locale.conf

1だけでは日本語UTF-8にならない為、このコマンドで設定を有効にします。localectlは有効オプションがない為locale.confを再読み込みする事で反映させます。localectlで設定したロケールは、/etc/locale.confに反映されます。

3 確認其の1 cat /etc/locale.conf

[hoge@sakura ~]# cat /etc/locale.conf
LANG=ja_JP.utf8

4 確認其の2 localectl status

[hoge@sakura ~]# localectl status
   System Locale: LANG=ja_JP.utf8
       VC Keymap: jp106
      X11 Layout: jp

5 確認其の3 locale

[hoge@sakura ~]# locale
LANG=ja_JP.utf8
LC_CTYPE="ja_JP.utf8"
LC_NUMERIC="ja_JP.utf8"
LC_TIME="ja_JP.utf8"
LC_COLLATE="ja_JP.utf8"
LC_MONETARY="ja_JP.utf8"
LC_MESSAGES="ja_JP.utf8"
LC_PAPER="ja_JP.utf8"
LC_NAME="ja_JP.utf8"
LC_ADDRESS="ja_JP.utf8"
LC_TELEPHONE="ja_JP.utf8"
LC_MEASUREMENT="ja_JP.utf8"
LC_IDENTIFICATION="ja_JP.utf8"
LC_ALL=

6 確認其の4 最終確認として日本語出力の確認

[root@]# hoge
bash: hoge: コマンドが見つかりません

bash: hoge: command not found

Lastly,I had changed the error that I above & keywords Japanese from English including several files like log or txt's content within 2 min..That's it.

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
What you can do with signing up
2