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

Łukasz Bensz picture Łukasz Bensz · Apr 28, 2015 · Viewed 31.5k times · Source

My system is SUSE Linux Enterprise Server 11.

I'm trying to convert a data from utf-8 format to iso useing "iconv"

$>file test.utf8
test.utf8: UTF-8 Unicode text, with very long lines
$>
$>file -i test.utf8
test.utf8: text/plain charset=utf-8
$>
$>iconv -f UTF-8 -t ISO-8859-1 test.utf8 > test.iso

iconv: test.utf8:20:105: cannot convert

Could you help me wit this? Thanks.

Answer

choroba picture choroba · Apr 28, 2015

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