java常見亂碼
1.request.getCharacterEncoding("utf-8");
2.new String(username.getBytes("iso-8859-1","utf-8"))
3.tomcat默認情況下只適合post傳值
在server.xml中找到Connector標籤 添加一個屬性useBodyEncodingForUrl="true"或者URIEncoding="utf-8";
4.數據庫與表設置
5.響應亂碼
response.setContextType("text/html");
response.setCharacterEncoding("utf-8");
6.連接字符串編碼設置
jdbc:mysql://localhost:3306/album?characterEncoding=utf-8