Unable to convert correct characters from gb2312 to utf8

Solution Unverified - Updated -

Issue

  • In the System , it is not able to covert the correct characters. For example, the original file charatercs is gb2312 or gb18030 gbk, run the below command:
iconv -t utf-8  example.txt -o  utf.txt 

There some error is as the below:

iconv : unkown 170  invalid  input 

The system Language environment is :

echo $LANG
LANG=zh_CN.gb2312

How to fix it ?

Environment

  • Red Hat Enterprise Linux 5

  • Red Hat Enterprise Linux 6

  • Red Hat Enterprise Linux 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.