Converting ISO-8859-1 to UTF-8
Detecting encodings and converting them with CLI tools
Published: Thursday, Oct 29, 2020 Last modified: Monday, Dec 9, 2024
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
ISO-8859-1
$ file data.txt
data.txt: ISO-8859 text
Converting ISO-8859-1 encoding to UTF-8
curl -s http://maps.natalian.org/data.txt | iconv -f ISO-8859-1 -t UTF-8 > data.txt