Scroll to navigation

nkf(1) nkf(1)

NAME

nkf - Network Kanji Filter

SYNOPSIS

nkf [-butjnesliohrTVvwWJESZxXFfmMBOcdILg] [file ...]

DESCRIPTION

Nkf is a yet another kanji code converter among networks, hosts and terminals. It converts input kanji code to designated kanji code such as ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 or UTF-16.

One of the most unique faculty of nkf is the guess of the input kanji encodings. It currently recognizes ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 and UTF-16. So users needn't set the input kanji code explicitly.

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 Shift_JIS. To accept X0201 in Shift_JIS, use -X, -x or -S.

OPTIONS

Output is buffered (DEFAULT), Output is unbuffered.
Output code is ISO-2022-JP (7bit JIS), Shift_JIS, EUC-JP, UTF-8N, UTF-16BE. Without this option and compile option, ISO-2022-JP is assumed.
Input assumption is JIS 7 bit, Shift_JIS, EUC-JP, UTF-8, UTF-16LE.
Assume JIS input. It also accepts EUC-JP. This is the default. This flag does not exclude Shift_JIS.
Assume Shift_JIS and X0201 kana input. It also accepts JIS. EUC-JP is recognized as X0201 kana. Without -x flag, X0201 kana (halfwidth kana) is converted into X0208.
Assume EUC-JP input. It also accepts JIS. Same as -J.
No conversion.
Specify the Esc Seq for JIS X 0208-1978/83. (DEFAULT B)
Specify the Esc Seq for ASCII/Roman. (DEFAULT B)
{de/en}crypt ROT13/47
Katakana to Hiragana conversion.
Hiragana to Katakana conversion.
Katakana to Hiragana and Hiragana to Katakana conversion.
Text mode output (MS-DOS)
ISO8859-1 (Latin-1) support
Folding on m length with n margin in a line. Without this option, fold length is 60 and fold margin is 10.
New line preserving line folding.
Convert X0208 alphabet (Fullwidth Alphabets) to ASCII.
Convert X0208 alphabet to ASCII.
Converts X0208 kankaku to single ASCII space.
Converts X0208 kankaku to double ASCII spaces.
Replacing Fullwidth >, <, ", & into '&gt;', '&lt;', '&quot;', '&amp;' as in HTML.
Assume X0201 kana in MS-Kanji. With -X or without this option, X0201 is converted into X0208 Kana. With -x, try to preserve X0208 kana and do not convert X0201 kana to X0208. In JIS output, ESC-(-I is used. In EUC output, SSO is used.
Assume broken JIS-Kanji input, which lost ESC. Useful when your site is using old B-News Nihongo patch.
allows any char after ESC-( or ESC-$.
forces ASCII after NL.
Replacing non iso-2022-jp char into a geta character (substitute character in Japanese).
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 stream is converted to space.
Non-strict decoding. It allows line break in the middle of the base64 encoding.
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.
Perfome quoted encoding.
Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP. -s, -e and -x are not compatible with this option.
Convert line breaks.
unix (LF)
windows (CRLF)
mac (CR)

Without this option, nkf doesn't convert line breaks.

convert for these system
convert for named code
assume input system
Set the input or output codeset. NKF supports following codesets and those codeset name are case insensitive.
a.k.a. RFC1468, 7bit JIS, JUNET
a.k.a. AT&T JIS, Japanese EUC, UJIS
Microsoft Version of EUC-JP.
a.k.a. SJIS, MS-Kanji
a.k.a. Windows-31J
same as UTF-8N
UTF-8 without BOM
UTF-8 with BOM
decomposed UTF-8
same as UTF-16BE
UTF-16 Big Endian without BOM
UTF-16 Big Endian with BOM
UTF-16 Little Endian without BOM
UTF-16 Little Endian with BOM
Specify the way that nkf handles unassigned characters. Without this option, --fb-skip is assumed.
When nkf converts to Shift_JIS, nkf adds a specified escape character to specified 2nd byte of Shift_JIS characters. 1st byte of argument is the escape character and following bytes are target characters.
Handle the characters extended in CP932 as unassigned characters.
When Unicode to Encoded byte conversion, don't convert characters which is not round trip safe. When Unicode to Unicode conversion, with this and -x option, nkf can be used as UTF converter. (In other words, without this and -x option, nkf doesn't save some characters)

When nkf convert string which related to path, you should use this opion.

Decode hex encoded characters.
Unescape percent escaped characters.
Decode character reference, such as "&#....;".
Overwrite original listed files by filtered result.

Note --overwrite preserves timestamp of original files.

Print guessed encoding.
Print nkf's help.
Print nkf's version.
--
Ignore rest of -option.

AUTHOR

Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa),2000 S. Kono, COW Copyright (C) 2002-2006 Kono, Furukawa, Naruse, mastodon

2006-08-22 nkf 2.0.8