0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Linux 文字コードの確認と変換

0
Last updated at Posted at 2022-12-17

概要

Shift-JISなどの日本語ファイル、文字化けファイルをUTF-8に治す方法
備忘録に、一番自分がやりやすく追加のインストールがいらない方法をメモしました

操作手順

文字コード確認
file -i ファイル名

vimで文字コード変換
:set fenc=utf-8

Vim操作
esc コマンド入力またはテキスト入力へモード切替
:q! 保存せず終了
:qw 保存して終了

または
iconvで文字コード変換
iconv -t test.txt

-f または --from-code=ENCODING_FORMAT 元のエンコードフォーマット
-t または --to-code=ENCODING_FORMAT変換したいフォーマット

参考記事

https://qiita.com/gunjo2000/items/a288a0128f4492892839
https://qiita.com/H_Neco/items/48fa2eaaa0d9af2e45fe

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?