Why iconv cannot convert from utf-8 to iso-8859-1 Why iconv cannot convert from utf-8 to iso-8859-1 linux linux

Why iconv cannot convert from utf-8 to iso-8859-1


Your input file contains characters that don't exist in Latin 1. You can use the -c option to skip them:

iconv -c -futf8 -tl1 test.utf8 > test.iso


Sometimes it's best to use both -c and //TRANSLIT, e.g.

$ cat rodriguezRodrı́guez$ file rodriguezrodriguez: UTF-8 Unicode text$ iconv  --unicode-subst="<U+%04X>" -f UTF-8 -t ISO-8859-1 rodriguezRodr<U+0131><U+0301>guez$ iconv -f UTF-8 -t ISO-8859-1 rodriguezRodriconv: rodriguez:1:4: cannot convert$ iconv -f UTF-8 -t ISO-8859-1//TRANSLIT rodriguezRodriiconv: rodriguez:1:5: cannot convert$ iconv -c -f UTF-8 -t ISO-8859-1 rodriguezRodrguez$ iconv -c -f UTF-8 -t ISO-8859-1//TRANSLIT rodriguezRodriguez


Use //TRANSLIT parameter and the dummy characters will be put.

iconv -f UTF-8 -t ISO-8859-1//TRANSLIT test.utf8 > test.iso