GNU/Linux man pages

Livre :
Expressions régulières,
Syntaxe et mise en oeuvre :

ISBN : 978-2-7460-9712-4
EAN : 9782746097124
(Editions ENI)


CentOS 2.1AS







nkf − Network Kanji code conversion Filter v1.9


nkf [ options ] [ file ]


Nkf is a yet another kanji code converter among networks, hosts and terminals. It converts input kanji code to designated kanji code such as 7-bit JIS, MS-kanji (shifted-JIS) or EUC.

One of the most unique facicility of nkf is the guess of the input kanji code. It currently recognizes 7-bit JIS, MS-kanji (shifted-JIS) and EUC. So users needn’t the input kanji code specification.

By default X0201 kana is converted into X0208 kana. For X0201 kana, SO/SI, SSO and ESC-(-I methods are supported. For automatic code detection, nkf assumes no X0201 kana in MS-Kanji. To accept X0201 in MS-Kanji, use −X, −x or −S.

Options are bellow:


bufferd output. This is a default.


unbufferd output.


no operations.


output 7-bit JIS code. This is a default.


output MS-kanji (shifted-JIS) code.


output EUC (AT&T) code.


output ESC−$−c as sequence to designate JIS-kanji (Default is B.)


output ESC−(−c as sequence to designate single-byte roman characters (Default is B.)


{de/en}crypt ROT13/47


display Version


Text mode output (MS-DOS)


MIME ISO-2022-JP/ISO8859-1 decode. (default) To see ISO8859-1 (Latin-1) −l is necessary.


Decode MIME base64 encoded stream. Remove header or other part before conversion.


Decode MIME quoted stream. ’_’ in quoted is converted to space.


No MIME decode.


MIME encode. Header style. All ASCII code and control characters are intact.


MIME encode. Base64 stream. Kanji conversion is performed before encoding, so this cannot be used as a picture encoder.


Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP. −s, −e and −x are not compatible with this option.


Folding on n length in a line. Default 60.


Allow X0201 kana in MS-Kanji. X0201 is converted into X0208 by default. This is default in MSDOS.


Try to preseve X0208 kana. Assume X0201 kana in MS-Kanji. And do not convert X0201 kana to X0208. In JIS output, ESC-(-I is used. In EUC output, SSO is used.


Convert X0208 alphabet to ASCII. −Z1 converts X0208 kankaku to one ASCII space. −Z2 converts X0208 kankaku to two ASCII spaces.


Assume MS-Kanji and X0201 kana input. It also accpet JIS. AT&T EUC is recognized as X0201 kana. Without −x flag, X0201 kana is converted into X0208.


Assume JIS input. It also accepts Japanese EUC. This is the default. This flag does not excludde MS-Kanji.


Assume AT&T EUC input. It also accpet JIS. Same as −J.


Assume broken JIS-Kanji, which lost ESC. Usefull when your site is using old B-News Nihongo patch. −B1 allows any char after ESC-( or ESC-$. −B2 forces ASCII after NL.


Output result to file. The first name in arguments becomes output. Please be careful. If there are no file arguments, nkf.out is chosen.


add CR after NL.


delete CR after NL.

-L[wmu] new line mode

-Lu unix (LF)
-Lw windows (CRLF)
-Lm mac (CR)
default no conversion


long options

--fj,--unix,--mac,--msdos, --windows
convert for these system

convert for named code
assume input system

-- ignore rest of -option



nkf - binary


Itaru Ichikawa <ichikawa@flab.fujitsu.co.jp> (was ichikawa@fujitsu.JUNET)


a_kuroe@hoffman.cc.sophia.ac.jp (Akihiko Kuroe) kono@ie.u-ryukyu.ac.jp (Shinji KONO)


Nkf cannot handle some input that contains mixed kanji codes. Automatic code detection becomes very weak with −x, −X and −S.