Java项目中有可能出现的乱码问题

1、JSP     

contentType="text/html; charset=utf-8" pageEncoding="UTF-8"

2、web.xml


  encodingFilter
  org.springframework.web.filter.CharacterEncodingFilter
  
   encoding
   UTF-8
  

  
   forceEncoding
   true
  

 

forceEncoding为true时会把request和response都强制转成encoding设置的编码

3、MySQL

jdbc:mysql://127.0.0.1:3306/training?useUnicode=true&characterEncoding=utf-8" />

4、Tomcat

server.xml里                   connectionTimeout="20000"
               redirectPort="8443"
               URIEncoding="utf-8" useBodyEncodingForURI=true />

你可能感兴趣的:(java)