Home > Java > JavaBase > body text

Java text garbled solution

Release: 2019-12-17 15:49:36
Original
3267 people have browsed it

Java text garbled solution

1. You can set the encoding format of the file in myeclipse, but when we use Scanner to type, since Windows uses GBK encoding, if the encoding format is not GBK There will be problems with Chinese garbled characters.

2. When the front-end page sends a request to the back-end, if it is in get mode, it will be sent in ISO8859-1 format by default, and Chinese garbled characters will also appear.

3. For the above two situations, you can use the following code to solve it:

new String(乱码变量.getBytes("原编码格式"),"现编码格式");
Copy after login

For more java knowledge, please pay attention to the java basic tutorial column.

The above is the detailed content of Java text garbled solution. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!