HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

nkf — Network kanji filter: convert kanji code from one encoding to another. More information: <https://ma

Submitted by: @import:tldr-pages··
0
Viewed 0 times
filternkfcommandkanjinetworkconvertcli

Problem

How to use the nkf command: Network kanji filter: convert kanji code from one encoding to another. More information: <https://manned.org/nkf>.

Solution

nkf — Network kanji filter: convert kanji code from one encoding to another. More information: <https://manned.org/nkf>.

Convert to UTF-8 encoding:
nkf -w {{path/to/file.txt}}


Convert to SHIFT_JIS encoding:
nkf -s {{path/to/file.txt}}


Convert to UTF-8 encoding and overwrite the file:
nkf -w --overwrite {{path/to/file.txt}}


Use LF as the new line code and overwrite (UNIX type):
nkf -d --overwrite {{path/to/file.txt}}


Use CRLF as the new line code and overwrite (windows type):
nkf -c --overwrite {{path/to/file.txt}}


Decrypt mime file and overwrite:
nkf -m --overwrite {{path/to/file.txt}}

Code Snippets

Convert to UTF-8 encoding

nkf -w {{path/to/file.txt}}

Convert to SHIFT_JIS encoding

nkf -s {{path/to/file.txt}}

Convert to UTF-8 encoding and overwrite the file

nkf -w --overwrite {{path/to/file.txt}}

Use LF as the new line code and overwrite (UNIX type)

nkf -d --overwrite {{path/to/file.txt}}

Use CRLF as the new line code and overwrite (windows type)

nkf -c --overwrite {{path/to/file.txt}}

Context

tldr-pages: common/nkf

Revisions (0)

No revisions yet.