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("原编码格式"),"现编码格式");
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!