JSP Chinese display question mark problem solution

Time:2020-10-28

Question: the Chinese that you want to output in JSP is displayed as “?”

Solution: search JSP in eclipse windows preferences, and select Chinese in the encoding option. In this way, the new JSP file will support Chinese display.

Modify the existing JSP file as follows: change all encoding methods to GB18030, as follows:

Copy codeThe code is as follows:
<%@ page language=”java” contentType=”text/html; charset=GB18030″
pageEncoding=”GB18030″%>
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=GB18030″>
<title>Hello</title>
</head>
<body>
Hello
</body>
</html>

Then “hello” can be displayed correctly