Session and utilities
The iconv command
Converts text between character encodings, for example from UTF-8 to ASCII or Latin-1.
Syntax
iconv -f ORIGEN -t DESTINO [archivo]Most useful options
-fSource encoding-tTarget encoding-lLists the available encodingsCopy-ready examples
$ printf 'abc\n' > i.txt && iconv -f UTF-8 -t ASCII i.txtConvert to ASCIIYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- If the target does not support a character (for example an ñ in ASCII), it can be lost or error.
FAQ
When is iconv needed?
When a file shows odd characters because it has another encoding.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course