φ(.. ) 備忘録
amazonアソシエイト

2013年12月8日日曜日

Cygwinでnkfインストール

文字コードの問題は、ほとんどの場合nkfで解決できる。私も常用している。
Cygwinでも今日コンパイルしたのでやり方を公開する。
  1. nkf-2.1.3.tar.gzをダウンロードし、「C:\cygwin64\usr\src」配下に配置。
  2. Setup.exeにて、gccをインストール。
  3. Cygwinターミナル起動
  4. cd /bin
  5. ln -s gcc.exe cc
  6. cd /usr/src
  7. tar zxvf nkf-2.1.3.tar.gz
  8. cd nkf-2.1.3/
  9. make
  10. make perl
  11. make test
  12. cp nkf.exe /usr/local/bin/
私は、/usr/local/binにpathを通しているので、これでnkfが常用できる。
~/.tcshrcで以下のように記載するとpathに追加できる。
set path=(/usr/local/bin $path)
使い方は、 nkf --help で勉強。
Usage:  nkf -[flags] [--] [in file] .. [out file for -O flag]
 j/s/e/w  Specify output encoding ISO-2022-JP, Shift_JIS, EUC-JP
          UTF options is -w[8[0],{16,32}[{B,L}[0]]]
 J/S/E/W  Specify input encoding ISO-2022-JP, Shift_JIS, EUC-JP
          UTF option is -W[8,[16,32][B,L]]
 m[BQSN0] MIME decode [B:base64,Q:quoted,S:strict,N:nonstrict,0:no decode]
 M[BQ]    MIME encode [B:base64 Q:quoted]
 f/F      Folding: -f60 or -f or -f60-10 (fold margin 10) F preserve nl
 Z[0-4]   Default/0: Convert JISX0208 Alphabet to ASCII
          1: Kankaku to one space  2: to two spaces  3: HTML Entity
          4: JISX0208 Katakana to JISX0201 Katakana
 X,x      Convert Halfwidth Katakana to Fullwidth or preserve it
 O        Output to File (DEFAULT 'nkf.out')
 L[uwm]   Line mode u:LF w:CRLF m:CR (DEFAULT noconversion)
 --ic=<encoding>        Specify the input encoding
 --oc=<encoding>        Specify the output encoding
 --hiragana --katakana  Hiragana/Katakana Conversion
 --katakana-hiragana    Converts each other
 --{cap, url}-input     Convert hex after ':' or '%'
 --numchar-input        Convert Unicode Character Reference
 --fb-{skip, html, xml, perl, java, subchar}
                        Specify unassigned character's replacement
 --in-place[=SUF]       Overwrite original files
 --overwrite[=SUF]      Preserve timestamp of original files
 -g --guess             Guess the input code
 -v --version           Print the version
 --help/-V              Print this help / configuration
Network Kanji Filter Version 2.1.3 (2013-11-22)
Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa).
Copyright (C) 1996-2013, The nkf Project.
UNIXシェル入門 (エッセンシャルソフトウェアガイドブック)
北浦 訓行 小島 範幸
技術評論社
売り上げランキング: 756,429

0 件のコメント :

コメントを投稿