An easy avenue in Windows to change the encoding of a file is to open it in Notepad and then use the Save As option which allows you to specify the encoding that the file should be saved using ...
Linux does offer a bunch of solutions too, albeit perhaps relatively less simple:
- One way is to change the encoding of the file in Vim.
- The other way (and probably the more general solution) is to use
iconv
:- First, use
file
to find out what the encoding of the file is at the moment:
$ file import.txt
which gave me,
import.txt: ISO-8859 English text, with very long lines, with CRLF line terminators - Now, use
iconv
to change the encoding (in my case, to UTF-8):
$ iconv -f ISO-8859-1 -t UTF-8 import.txt > import2.txt
The
-f
and-t
switched denote the from file and the to file. Also,
note that I'm using ISO-8859-1 as the encoding value rather than simply ISO-8859 (which is whatfile
output).iconv
does not recognise ISO-8859 as a legitimate value.
Now, import2.txt contains a UTF-8 version of import.txt.
- First, use
- Log in to post comments