Conversion from EBCDIC to UTF8 in Linux

I have imported with Perl a table from our database AS/400 DB2.

The problem is that the string are encoded in EBCDIC Latin-1 (italian language).

How can I convert the resulting file to plain utf-8 in Linux bash?


  • It's simple with iconv.

    iconv -f ISO8859-1   -t "UTF-8" result.csv -o new_result.csv

    ISO8859-1 is the Latin-1 encoding format. For a list of encodings, refer t this table from official IBM documentation:

    Note that the conversion may leave non valid UTF-8 characters from EBCDIC. An example are NULL characters in the strings. To avoid this, use an HEX editor and replace hex values from 00 to 20 (space character).