LoginSignup
5
8

More than 5 years have passed since last update.

nkfで入力エンコードを明示する

Posted at

コマンド例

nkf --ic=CP932 --oc=UTF-8 [input file] > [output file]

【意味】入力ファイルはWinodowsのSJIS(それがCP932)で、UTF8に変換して出力しないさいよ。

説明

nkfのサンプルの大半が、入力エンコードを自動判定に頼ってる。ただし自動判定は失敗することもありえるので、明示的に入力エンコードを指定する。SJISだと幾つかパターンがあるので、CP932とさらに絞り込んだ形で明示する。これなら、nkfを使ったことがない人でも、コマンドをみただけで理解ができる。

5
8
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
5
8