Menu

dk-cat

Dirk Krause
← Previous ↑ Home → Next

dk-cat — Show file contents

Description

The dk-cat program shows text files and can change the encoding between plain, win1252, UTF-8, UTF-16 or 32-bit UNICODE.
The systems default encoding is used for output unless you specify a different encoding using the -o option.
Input encoding is found automatically when a BOM is found at start of text, otherwise you can specify an expected encoding using the -i option or expect the systems default encoding.

Options are available to show line numbers or to normalize lines (remove leading and trailing whitespaces, replace whitespace sequences by a single space).

Examples

Convert file from UTF-8 to UTF-16

If you have a text file input.txt created on a recent Linux system in UTF-8 encoding and you want to view or process it on Windows, run:

dk-cat -i utf-8 -o utf-16,bom < input.txt > output.txt
Options Purpose
-i utf-8 Expected input encoding is UTF-8.
-o utf-16,bom Produce output in UTF-16 encoding with a byte order marker at the beginning of the file.

Convert file from UTF-16 to UTF-8

If you edited a file input.txt on Windows in an editor (i.e. notepad) it is either in win1252 or in UTF-16-LE encoding. Specify win1252 as default encoding, if the file is in UTF-16-LE dk-cat recognizes the BOM at start.

dk-cat -i win1252 -o utf-8 < input.txt > output.txt

Manual

See the [dk-cat manual] for the full documentation of the program.


← Previous ↑ Home → Next

Related

Wiki: Home
Wiki: dk-cat manual