Home > Java > JavaBase > Solution to garbled code displayed in java

Solution to garbled code displayed in java

Release: 2019-12-16 10:08:14
Original
2991 people have browsed it

Solution to garbled code displayed in java

Solution to java displaying garbled characters:

1. The browser calls jsp, html and other pages display garbled characters in Chinese

This situation needs to meet two requirements:

(1) The file itself is edited and saved in utf-8 (right click on the properties in myEclipse and select utf-8)

(2 ) The browser uses utf-8 to parse:

(manual)==> Right-click in the browser and select the encoding format as utf-8

(smart)==> Write in the file For example: Use the tag to simulate the response header, which tells the browser to use UTF-8 encoding and parsing

(Smart)==> response.setContentType("text/html;charset=UTF-8"); tells the browser to use UTF-8 encoding analysis

Commonly used:

<meta name="content-type" content="text/html; charset=UTF-8">或<meta charset="utf-8">
<%@ pageEncoding="utf-8"%>
<?xml encoding="UTF-8"?>
Copy after login

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

The above is the detailed content of Solution to garbled code displayed in java. 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