iconv command in Linux with Examples
iconv command is used to convert some text in one encoding into another encoding. If no input file is provided then it reads from standard input. Similarly, if no output file is given then it writes to standard output. If no from-encoding or to-encoding is provided then it uses current local’s character encoding.
iconv [options] [-f from-encoding] [-t to-encoding] [inputfile]...
- -f from-encoding, –from-code=from-encoding : Use from-encoding for input characters.
- -t to-encoding, –to-code=to-encoding : Use to-encoding for output characters.
- -l, –list : List all known character set encodings.
- -c : Silently discard characters that cannot be converted instead of terminating when encountering such characters.
- -o outputfile, –output=outputfile : Use outputfile for output.
- –verbose : Print progress information on standard error when processing multiple files.
- If the string //IGNORE is appended to to-encoding, characters that cannot be converted are discarded and an error is printed after conversion.
- If the string //TRANSLIT is appended to to-encoding, characters that cannot be represented in the target character set, it can be approximated through one or several similar looking characters.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!