Convert any input to UTF-8 by detecting its encoding.

This uses Google’s Compact Encoding Detection to guess the encoding, before converting from that encoding to UTF-8.


Install with npm globally:

npm install --global @cmbuckley/toutf8


toutf8 [inputfile]...

The toutf8 program detects the most likely character encoding of text and converts it to UTF-8. All the inputfile arguments will be read and converted. If no input files are provides, standard input is used. The converted text is printed to standard output.

toutf8 < random-encoding.txt > utf8.txt