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.
Going backwards from UTF-8 to ISO-8859-1 will cause "replacement characters" (�) to appear in your text when unsupported characters are found. byte[] utf8 = ... byte[] latin1 = new String(utf8, "UTF-8"). getBytes("ISO-8859-1"); You can exercise more control by using the lower-level Charset APIs.
UTF-8 is a multibyte encoding that can represent any Unicode character. ISO 8859-1 is a single-byte encoding that can represent the first 256 Unicode characters. Both encode ASCII exactly the same way.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With