NKF(3pm)
๐ NAME ๐
okay so bestie, welcome to NKF(3pm) ๐
this is the page for nkf โ a kanji code converter that hops between networks, hosts and terminals โ as it shows up in the Perl world (see the little nkf(...) call down below, iykyk). Sit down, grab a strawberry ๐, and let's get you fluent.
โจ SYNOPSIS โจ
ngl there's no big synopsis flex at the top of this one โ the whole vibe lives in DESCRIPTION and OPTIONS right underneath. Scroll, queen ๐
๐ฆ DESCRIPTION ๐ฆ
Nkf is a yet another kanji code converter among networks, hosts and terminals. Like, it takes your input kanji code and converts it to the designated kanji code โ things like ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8, UTF-16 or UTF-32. periodt.
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, UTF-16 and UTF-32. So users needn't set the input kanji code explicitly. it just knows. main character energy fr fr.
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. โ๏ธ
multiple options are specifed as seprate strings, such as
print nkf('--ic=UTF8-MAC', '-w', $string), "\n";
except the last arguments. (yeah, sneak that last one in there, she's special ๐ )
๐ OPTIONS ๐
๐ Encodings, in and out
-J,-S,-E,-W,-W16,-W32,-j,-s,-e,-w,-w16,-w32โ Specify input and output encodings. Upper case is input. cf.--icand--oc.-Jโ ISO-2022-JP (JIS code).-Sโ Shift_JIS and JIS X 0201 kana. EUC-JP is recognized as X0201 kana. Without-xflag, JIS X 0201 Katakana (a.k.a.halfwidth kana) is converted into JIS X 0208. If you use Windows, see Windows-31J (CP932).-Eโ EUC-JP.-Wโ UTF-8N.-W16[BL][0]โ UTF-16.BorLgives whether Big Endian or Little Endian.0gives whther put BOM or not.-W32[BL][0]โ UTF-32.BorLgives whether Big Endian or Little Endian.0gives whther put BOM or not.
๐ธ Buffering & chill
-b,-uโ Output is buffered (DEFAULT), Output is unbuffered.-tโ No conversion. just vibes, untouched โจ
๐ง Escape sequences & friends
-i[@B]โ Specify the escape sequence for JIS X 0208.-i@โ Use ESC ( @. (JIS X 0208-1978)-iBโ Use ESC ( B. (JIS X 0208-1983/1990 DEFAULT)
-o[BJ]โ Specify the escape sequence for US-ASCII/JIS X 0201 Roman. (DEFAULT B)-rโ {de/en}crypt ROT13/47 ๐ต๏ธ
๐ Kana glow-ups
-h[123],--hiragana,--katakana,--katakana-hiragana-h1,--hiraganaโ Katakana to Hiragana conversion.-h2,--katakanaโ Hiragana to Katakana conversion.-h3,--katakana-hiraganaโ Katakana to Hiragana and Hiragana to Katakana conversion.
๐ซถ Output modes & folding
-Tโ Text mode output (MS-DOS)-f[m [- n]]โ Folding on m length with n margin in a line. Without this option, fold length is 60 and fold margin is 10.-Fโ New line preserving line folding.
๐ฅ Fullwidth alphabet shenanigans
-Z[0-3]โ Convert X0208 alphabet (Fullwidth Alphabets) to ASCII.-Z,-Z0โ Convert X0208 alphabet to ASCII.-Z1โ Convert X0208 kankaku to single ASCII space.-Z2โ Convert X0208 kankaku to double ASCII spaces.-Z3โ Replacing fullwidth >, <, ", & into '>', '<', '"', '&' as in HTML.
๐ X0201 kana policy
-X,-xโ With-Xor 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, SS2 is used.
๐ Broken-JIS rescue mission
-B[0-2]โ Assume broken JIS-Kanji input, which lost ESC. Useful when your site is using old B-News Nihongo patch.-B1โ allows any chars after ESC-( or ESC-$.-B2โ force ASCII after NL.
๐ geta character moment
-Iโ Replacing non iso-2022-jp char into a geta character (substitute character in Japanese).
๐ MIME decode
-m[BQN0]โ MIME ISO-2022-JP/ISO8859-1 decode. (DEFAULT) To see ISO8859-1 (Latin-1)-lis necessary.-mBโ Decode MIME base64 encoded stream. Remove header or other part before conversion.-mQโ Decode MIME quoted stream. '_' in quoted stream is converted to space.-mNโ Non-strict decoding. It allows line break in the middle of the base64 encoding.-m0โ No MIME decode.
โญ MIME encode
-Mโ MIME encode. Header style. All ASCII code and control characters are intact.-MBโ MIME encode Base64 stream. Kanji conversion is performed before encoding, so this cannot be used as a picture encoder.-MQโ Perform quoted encoding.
๐ Latin-1 (with boundaries, bestie)
-lโ Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP.-s,-eand-xare not compatible with this option.
๐ง Line break control
-L[uwm],-d,-cโ Convert line breaks.-Lu,-dโ unix (LF)-Lw,-cโ windows (CRLF)-Lmโ mac (CR)
Without this option, nkf doesn't convert line breaks. ๐จ
โจ System presets
--fj,--unix,--mac,--msdos,--windowsโ Convert for these systems.--jis,--euc,--sjis,--mime,--base64โ Convert to named code.--jis-input,--euc-input,--sjis-input,--mime-input,--base64-inputโ Assume input system
๐ธ The codeset menu
--ic=input codeset,--oc=output codesetโ Set the input or output codeset. NKF supports following codesets and those codeset names are case insensitive.ISO-2022-JPโ a.k.a. RFC1468, 7bit JIS, JUNETEUC-JP(eucJP-nkf) โ a.k.a. AT&T JIS, Japanese EUC, UJISeucJP-asciieucJP-msCP51932โ Microsoft Version of EUC-JP.Shift_JISโ a.k.a. SJIS, MS_KanjiWindows-31Jโ a.k.a. CP932UTF-8โ same as UTF-8NUTF-8Nโ UTF-8 without BOMUTF-8-BOMโ UTF-8 with BOMUTF8-MAC(input only) โ decomposed UTF-8UTF-16โ same as UTF-16BEUTF-16BEโ UTF-16 Big Endian without BOMUTF-16BE-BOMโ UTF-16 Big Endian with BOMUTF-16LEโ UTF-16 Little Endian without BOMUTF-16LE-BOMโ UTF-16 Little Endian with BOMUTF-32โ same as UTF-32BEUTF-32BEโ UTF-32 Big Endian without BOMUTF-32BE-BOMโ UTF-32 Big Endian with BOMUTF-32LEโ UTF-32 Little Endian without BOMUTF-32LE-BOMโ UTF-32 Little Endian with BOM
๐ซถ Unassigned characters & byte etiquette
--fb-{skip, html, xml, perl, java, subchar}โ Specify the way that nkf handles unassigned characters. Without this option,--fb-skipis assumed.--prefix=escape charactertarget character..โ 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.--no-cp932extโ Handle the characters extended in CP932 as unassigned characters.--no-best-fit-charsโ When Unicode to Encoded byte conversion, don't convert characters which is not round trip safe. When Unicode to Unicode conversion, with this and-xoption, nkf can be used as UTF converter. (In other words, without this and-xoption, nkf doesn't save some characters)
When nkf converts strings that related to path, you should use this opion. ๐
--cap-inputโ Decode hex encoded characters.--url-inputโ Unescape percent escaped characters.--numchar-inputโ Decode character reference, such as "&#....;".--โ Ignore rest of -option.
๐ AUTHOR ๐
Copyright (c) 1987, Fujitsu LTD. (Itaru ICHIKAWA).
Copyright (c) 1996-2018, The nkf Project.
and that's the whole page, bestie ๐ this was NKF(3pm) from the User Contributed Perl Documentation collection, shipped as perl v5.42.3 on 2026-08-20 โ go forth and convert, you absolute icon โจ๐๐ฆ๐
๐ฆ where this page comes from
- ubuntu stonking: libnkf-perl 1:2.1.5-1.1build1 ยท Custom
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms