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 3 years have passed since last update.

mac > 文字コード変換 > nkf

Last updated at Posted at 2020-09-23

インストール

brew install nkf

文字コード調査

nkf -g hoge.txt

結果は以下のように表示されます
UTF-8

変換

sjisへ変換

上書き

上書き
nkf -s --overwrite hoge.txt

名前を変えて変換

名前を変えて変換
nkf -s hoge.txt > pekehoge.txt

変換結果を確認

nkf -g hoge.txt
Shift_JIS

utf-8へ変換

上書き
nkf -w --overwrite hoge.txt
名前を変えて変換
nkf -w hoge.txt > pekehoge.txt

変換結果を確認

nkf -g hoge.txt
UTF-8

参考

Network Kanji Filter - Wikipedia

公式サイト nkf Network Kanji Filter Project Top Page - OSDN

【 nkf 】コマンド――文字コードと改行コードを変換する:Linux基本コマンドTips(51) - @IT

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?