这里只说关于UTF-8的乱码问题。
先说一下个人遇到的乱码有哪些:1.任何浏览器都乱码...。
2.火狐、chrome显示中文,IE乱码。
3.IE完全乱码。
4.IE查询数据库信息不乱吗,jsp中文中乱码
进入正题,解决以上问题的方法:
1.项目->属性->资源 文本文件编码 点其他选UTF-8.
2.找到你tomcat配置文件位置,conf文件夹打开server.xml找到<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"URLEncoding="utf-8"/>是否一样,如果没有把它加到<Service name="Catalina"></Service>之间。
3.在jsp中
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4.
慎用,加入web页面可能无法访问
在WEB-INF下的web.xml中加入
<jsp-config><jsp-property-group>
<description> For config the web application </description>
<display-name>JSPConfiguration</display-name>
<url-pattern>*.jsp</url-pattern>
<el-ignored>false</el-ignored>
<page-encoding>UTF-8</page-encoding>
</jsp-property-group>
</jsp-config>
在jsp中
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">