nkf のインストール
(Mac OSX & Cygwin on Windows)

定番 nkf をインストールします。


  1. まえがき
  2. インストール
  3. 設定
  4. 使い方

関連するページはこちら、

MacOSX & Cygwin on Windows のソフトの事


1. まえがき

定番 nkf をインストールします。

Cygwin のパイプ処理でこけることがあるので、ほんのちょっと弄ってます。


2. インストール

2.1. References

Homepage
http://nkf.sourceforge.jp/
Source
https://sourceforge.jp/projects/nkf/

2.2. make & install (Leopard & Cygwin)

解凍して、此のパッチ

*** nkf.c.orig	Sun Nov 19 07:11:39 2006
--- nkf.c	Sun Nov 19 07:12:42 2006
***************
*** 1013,1018 ****
--- 1013,1019 ----
          fclose(stdout);
  #else /* for Other OS */
      if (file_out_f == TRUE)
+         fflush(stdout);
          fclose(stdout);
  #endif /*Easy Win */
      return (0);

を当てて、

bash$ make
bash$ make test
bash$ sudo cp nkf /usr/local/bin ( <-- cygwin の場合、nkf.exe)
bash$ sudo cp nkf.1 /usr/local/man/man1
bash$ sudo cp nkf.1j /usr/local/man/ja/man1/nkf.1
bash$ perl Makefile.PL
bash$ make
bash$ sudo make install

するだけ。因に、Leopard の依存関係は、下のとおり。

$ otool -L /usr/local/bin/nkf
/usr/local/bin/nkf:
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0)

又、2007-11-10 現在、バージョンは

$ nkf --version
Network Kanji Filter Version 2.0.8 (2007-07-20)
Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW
Copyright (C) 2002-2007 Kono, Furukawa, Naruse, mastodon


2.3. make & install (Tiger)

10.4 の時の、依存関係は、下のとおり。

$ otool -L /usr/local/bin/nkf
/usr/local/bin/nkf:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.5.1)

又、2007-06-16 現在、バージョンは

$ nkf --version
Network Kanji Filter Version 2.0.7 (2006-06-13)
Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW
Copyright (C) 2002-2006 Kono, Furukawa, Naruse, mastodon


3. 設定

特に無し。


4.使い方

ヘルプから

bash$ nkf --help
USAGE:  nkf(nkf32,wnkf,nkf2) -[flags] [in file] .. [out file for -O flag]
Flags:
b,u      Output is buffered (DEFAULT),Output is unbuffered
j,s,e,w  Outout code is JIS 7 bit (DEFAULT), Shift JIS, EUC-JP, UTF-8N
         After 'w' you can add more options. -w[ 8 [0], 16 [[BL] [0]] ]
J,S,E,W  Input assumption is JIS 7 bit , Shift JIS, EUC-JP, UTF-8
         After 'W' you can add more options. -W[ 8, 16 [BL] ]
t        no conversion
i[@B]    Specify the Esc Seq for JIS X 0208-1978/83 (DEFAULT B)
o[BJH]   Specify the Esc Seq for ASCII/Roman        (DEFAULT B)
r        {de/en}crypt ROT13/47
h        1 katakana->hiragana, 2 hiragana->katakana, 3 both
v        Show this usage. V: show version
m[BQN0]  MIME decode [B:base64,Q:quoted,N:non-strict,0:no decode]
M[BQ]    MIME encode [B:base64 Q:quoted]
l        ISO8859-1 (Latin-1) support
f/F      Folding: -f60 or -f or -f60-10 (fold margin 10) F preserve nl
Z[0-3]   Convert X0208 alphabet to ASCII
         1: Kankaku to 1 space  2: to 2 spaces  3: Convert to HTML Entity
X,x      Assume X0201 kana in MS-Kanji, -x preserves X0201
B[0-2]   Broken input  0: missing ESC,1: any X on ESC-[($]-X,2: ASCII on NL
O        Output to File (DEFAULT 'nkf.out')
I        Convert non ISO-2022-JP charactor to GETA
d,c      Convert line breaks  -d: LF  -c: CRLF
-L[uwm]  line mode u:LF w:CRLF m:CR (DEFAULT noconversion)

Long name options
 --ic=<input codeset>  --oc=<output codeset>
                   Specify the input or output codeset
 --fj  --unix --mac  --windows
 --jis  --euc  --sjis  --utf8  --utf16  --mime  --base64
                   Convert for the system or code
 --hiragana  --katakana  --katakana-hiragana
                   To Hiragana/Katakana Conversion
 --prefix=         Insert escape before troublesome characters of Shift_JIS
 --cap-input, --url-input  Convert hex after ':' or '%'
 --numchar-input   Convert Unicode Character Reference
 --fb-{skip, html, xml, perl, java, subchar}
                   Specify how nkf handles unassigned characters
 --in-place[=SUFFIX]  --overwrite[=SUFFIX]
                   Overwrite original listed files by filtered result
                   --overwrite preserves timestamp of original files
 -g  --guess       Guess the input code
 --help  --version Show this help/the version
                   For more information, see also man nkf

Network Kanji Filter Version 2.0.7 (2006-06-13)
Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW
Copyright (C) 2002-2006 Kono, Furukawa, Naruse, mastodon