iconv(1)
๐ NAME ๐
iconv โ convert text from one character encoding to another ๐ฆ
okay so bestie, listen: this is iconv, and she lives in the General Commands Manual (section 1, the girlies). she takes your text and swaps the character encoding, like a translator but for bytes instead of words. iconic. periodt. โจ
๐ SYNOPSIS ๐
iconv [options] [-f from-encoding] [-t to-encoding] [inputfile ...]
๐ธ DESCRIPTION ๐ธ
The iconv program reads in text in one encoding and outputs the text in another encoding. fr fr that's the whole vibe.
If no input files are given, or if it is given as a dash (-), iconv reads from standard input. If no output file is given, iconv writes to standard output. no cap.
If no from-encoding is given, the default is derived from the current locale's character encoding. If no to-encoding is given, the default is derived from the current locale's character encoding too. so basically she just mirrors your locale unless you tell her otherwise ๐
โจ OPTIONS โจ
--from-code=from-encoding,-f from-encodingโ Use from-encoding for input characters. this is you telling her "hey, the stuff I'm feeding you is in THIS encoding" ๐--to-code=to-encoding,-t to-encodingโ Use to-encoding for output characters. and this is you being like "and spit it back out in THIS one" ๐
If the string //IGNORE is appended to to-encoding, characters that cannot be converted are discarded and an error is printed after conversion. (Characters that cannot be decoded are treated as an error with or without this flag.) lowkey chaotic but okay bestie ๐คช
If the string //TRANSLIT is appended to to-encoding, characters being converted are transliterated when needed and possible. This means that when a character cannot be represented in the target character set, it can be approximated through one or several similar looking characters. Characters that are outside of the target character set and cannot be transliterated are replaced with a question mark (?) in the output. it's giving "close enough" energy ๐
--list,-lโ List all known character set encodings. the full menu, the whole menu, every single one ๐-cโ Discard characters that cannot be converted instead of terminating when encountering such characters. POSIX requires that this option does not change the exit status of the program. so like, she keeps going instead of dramatically storming out ๐ช๐จ--output=outputfile,-o outputfileโ Use outputfile for output. put it in a file instead of screaming it into your terminal ๐--silent,-sโ This option is ignored; it is provided only for compatibility. literally does nothing. a decorative ghost ๐ป--verboseโ Print progress information on standard error when processing multiple files. she's narrating her little journey ๐ฃ๏ธ--help,-?โ Print a usage summary and exit. your "help me pls" button ๐--usageโ Print a short usage summary and exit. the sparknotes version, the tl;dr, the summary bestie โจ--version,-Vโ Print the version number, license, and disclaimer of warranty foriconv. receipts, legal receipts ๐
๐ฆ EXIT STATUS ๐ฆ
Zero on success, nonzero on errors. clean. simple. she either slayed or she didn't โ โ
๐ ENVIRONMENT ๐
Internally, the iconv program uses the iconv(3) function, which in turn uses gconv modules (dynamically loaded shared libraries โ yes, actual shared libraries, she's fancy like that) to convert to and from a character set. Before calling iconv(3), the iconv program must first allocate a conversion descriptor using iconv_open(3). The operation of the latter function is influenced by the setting of the GCONV_PATH environment variable:
- If
GCONV_PATHis not set,iconv_open(3)loads the system gconv module configuration cache file created byiconvconfig(8)and then, based on the configuration, loads the gconv modules needed to perform the conversion. If the system gconv module configuration cache file is not available, then the system gconv module configuration file is used. ok so she checks the cache first, then falls back fr fr ๐ - If
GCONV_PATHis defined (as a colon-separated list of pathnames), the system gconv module configuration cache is not used. Instead,iconv_open(3)first tries to load the configuration files by searching the directories inGCONV_PATHin order, followed by the system default gconv module configuration file. If a directory does not contain a gconv module configuration file, any gconv modules that it may contain are ignored. If a directory contains a gconv module configuration file and it is determined that a module needed for this conversion is available in the directory, then the needed module is loaded from that directory, the order being such that the first suitable module found inGCONV_PATHis used. This allows users to use custom modules and even replace system-provided modules by providing such modules inGCONV_PATHdirectories. she's got main character energy and she WILL swap out the system's modules if you ask nicely ๐
๐ FILES ๐
/usr/lib/gconvโ Usual default gconv module path. the usual hangout spot ๐/usr/lib/gconv/gconv-modulesโ Usual system default gconv module configuration file. the usual config ๐/usr/lib/gconv/gconv-modules.cacheโ Usual system gconv module configuration cache. the usual cache, the fast lane โก
Depending on the architecture, the above files may instead be located at directories with the path prefix/usr/lib64. so check/usr/lib64bestie, don't get caught lacking ๐ซถ
๐ STANDARDS ๐
POSIX.1-2008. certified, official, approved by the girlies who write standards ๐
๐ฐ๏ธ HISTORY ๐ฐ๏ธ
POSIX.1-2001. she's been around. a legacy. an icon. respect her ๐
๐งช EXAMPLES ๐งช
Convert text from the ISO/IEC 8859-15 character encoding to UTF-8:
$ iconv -f ISO-8859-15 -t UTF-8 < input.txt > output.txt;
The next example converts from UTF-8 to ASCII, transliterating when possible:
$ echo abc ร ฮฑ โฌ ร แธรง | iconv -f UTF-8 -t ASCII//TRANSLIT;
abc ss ? EUR abc
see how the ร became ss, the ฮฑ became a ?, the โฌ became EUR, and the ร แธรง became abc?? that's the //TRANSLIT magic doing her little dance โจ๐ฆ
๐ SEE ALSO ๐
locale(1), uconv(1), iconv(3), nl_langinfo(3), charsets(7), iconvconfig(8)
okay that's the whole thing bestie, go convert some encodings, you got this ๐ซถ๐ this page is from Linux man-pages 6.20, dated 2025-09-21 โ slay, and happy encoding โจ๐
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms