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 for iconv. 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_PATH is not set, iconv_open(3) loads the system gconv module configuration cache file created by iconvconfig(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_PATH is 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 in GCONV_PATH in 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 in GCONV_PATH is used. This allows users to use custom modules and even replace system-provided modules by providing such modules in GCONV_PATH directories. 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/lib64 bestie, 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