Converting ISO-8859-1 to UTF-8

Detecting encodings and converting them with CLI tools

Published: Thursday, Oct 29, 2020 Last modified: Monday, Aug 2, 2021

Go doesn’t automatically transform content in the other encodings. You need to check your inputs and the way I’m doing it is like so.

Detect encoding of a file

$ uchardet data.txt
$ file data.txt
data.txt: ISO-8859 text

Converting ISO-8859-1 encoding to UTF-8

curl -s | iconv -f ISO-8859-1 -t UTF-8 > data.txt