How to solve the garbled characters when reading local files in Linux

Source: Internet
Author: User
Solve the Problem of garbled characters reading part of local files in Linux-Linux Enterprise Application-Linux server application information. The following is a detailed description. The running environment for batch add information is: Linux AS 2.1 + Was5

This is an I/O operation for JDK to read local files while reading the htm files uploaded by FTP to the memory, which is closely related to the operating system's encoding, after checking that the default encoding set in Linux is GB2312, the "-" symbol cannot be converted to characters using GB2312, resulting in "?" . In the process of testing, I tried to modify the encoding method of the program. The actual test did not work, no matter whether it was throttling or throttling, because it is processed after I/O operations read "-" In GB2312 encoding.

After testing and modifying the Linux environment variable, change its encoding from GB2312 to GBK, and "-" will be displayed normally.

Specific operation process: log on to the linux system as a system administrator, modify. bash_profile, and change the attribute values of the following two parameters from gb2312 to GBK as follows:

Export LANG = zh_CN.GBK
Export LC_ALL = zh_CN.GBK

Then restart the WebSphere server.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.