- <%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8"%>
- <!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=UTF-8">
強制爲utf8
jetty上,post的中文可以直接讀取(採用@RequestParam方式,servlet的request.get
也可以讀)
get的中文參數讀取在ie亂碼,後在ie中使用js的encodeURI(encodeURI(url))解決。
war包直接移植到tomcat後,post,get皆讀取中文亂碼,
使用 org.springframework.web.filter.CharacterEncodingFilter
可以解決post亂碼
現在就是無法解決tomcat的 get亂碼問題
<Connector
connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" />
改爲:
<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort="8443" useBodyEncodingForURI="true"/>
或者
<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8" />