Home >Java >JavaBase >What to do if java utf-8 garbled characters

What to do if java utf-8 garbled characters

藏色散人
藏色散人Original
2020-04-05 09:32:372942browse

What to do if java utf-8 garbled characters

What should I do if java utf-8 is garbled?

1. Write the following code in the first part of html:

Recommended tutorial: "java learning"

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>

The example is as follows:

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>


<script>
</script>
login.jsp


姓名:
密码:

If unsuccessful,

2. Modify the properties of the garbled project file. The garbled code is as shown in the figure.

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    


  login.jsp


     
濮撳悕锛�
瀵嗙爜锛�

Right-click the login.jsp under the project and select the bottom Properties

What to do if java utf-8 garbled characters

Select Other and change to utf-8

What to do if java utf-8 garbled characters

Click Apply, OK

If unsuccessful,

3. Right-click the project and perform the above operations

What to do if java utf-8 garbled characters

If it still fails,

4. Right-click the garbled file under the project,

What to do if java utf-8 garbled characters

Click on the pattern in the red box to find the original file (you can also find the original file on my computer)

What to do if java utf-8 garbled characters

Open with Edit with Notepad

What to do if java utf-8 garbled characters

Click encoding, select "Use UTF-8 encoding", and then save

What to do if java utf-8 garbled characters

In addition to the above four types, you can also select Properties under Project to modify properties as shown below

What to do if java utf-8 garbled characters

##

The above is the detailed content of What to do if java utf-8 garbled characters. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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