Solution to garbled characters after jboss uploads txt files in linux

Source: Internet
Author: User
Solution for garbled characters after jboss uploads txt files in linux-Linux general technology-Linux technology and application information. The following is a detailed description. The default encoding for linux is UTF-8 and for windows is GB2312. Therefore, if reading and writing txt files in linux is different from that in windows, the encoding must be unified.
If UTF-8 is used to read txt files in linux, it is very easy to encounter problems, because the default encoding format of windows client is GB2312. how can this problem be solved?
Solution: both read and write data are encoded in gbk format. The procedure is as follows:
1. when reading a file, the txt file can be read regardless of the byte Upload stream, because the default value is GB2312.
2. if no transcoding string is available after data is saved, use gbk for transcoding.

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.