LinuxCommandLibrary

nkf

TLDR

Convert to UTF-8

$ nkf -w [input.txt] > [output.txt]
copy
Convert to Shift-JIS
$ nkf -s [input.txt] > [output.txt]
copy
Convert to EUC-JP
$ nkf -e [input.txt] > [output.txt]
copy
Auto detect and convert
$ nkf -w --guess [input.txt]
copy
Convert in place
$ nkf -w --overwrite [file.txt]
copy
Show input encoding
$ nkf --guess [file.txt]
copy

SYNOPSIS

nkf [options] [files]

DESCRIPTION

nkf (Network Kanji Filter) converts Japanese text encodings. Handles UTF-8, Shift-JIS, EUC-JP.
The tool auto-detects encodings. Essential for Japanese text processing.
nkf converts Japanese encodings.

PARAMETERS

FILES

Files to convert.
-w
Convert to UTF-8.
-s
Convert to Shift-JIS.
-e
Convert to EUC-JP.
--guess
Detect encoding.
--overwrite
Modify file in place.
--help
Display help information.

CAVEATS

Japanese text focused. Auto-detection may fail. Backup before overwrite.

HISTORY

nkf was created for Japanese computing, handling various encodings used in Japan.

SEE ALSO

iconv(1), uconv(1), recode(1)

Copied to clipboard