本文介绍了在Linux中从EBCDIC转换为UTF8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我已经用Perl从我们的数据库AS/400 DB2中导入了一个表.

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

问题在于该字符串以EBCDIC Latin-1(意大利语)编码.

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

如何在Linux bash中将生成的文件转换为纯utf-8?

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

推荐答案

使用 iconv 很简单.

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

ISO8859-1是Latin-1编码格式.有关编码的列表,请参阅IBM官方文档中的该表: https://www.ibm.com/support/knowledgecenter/ssw_aix_53/com.ibm.aix.nls/doc/nlsgdrf/iconv.htm%23d722e3a267mela

ISO8859-1 is the Latin-1 encoding format. For a list of encodings, refer t this table from official IBM documentation: https://www.ibm.com/support/knowledgecenter/ssw_aix_53/com.ibm.aix.nls/doc/nlsgdrf/iconv.htm%23d722e3a267mela

请注意,该转换可能会保留来自EBCDIC的无效UTF-8字符.一个示例是字符串中的NULL字符.为避免这种情况,请使用十六进制编辑器,并将十六进制值从00替换为20(空格字符).

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).

这篇关于在Linux中从EBCDIC转换为UTF8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 13:06