2013年10月31日星期四

jsp get inside the way , IE inside garbled , Firefox and other browsers normal problem

$ {deptNameSearch} there is a Chinese , to the action which is garbled.
page encoding settings :
<% @ page language = "java" contentType = "text / html; charset = UTF-8" pageEncoding = "UTF-8"%>
TOMCAT encoding settings :


Firefox , GOOGLE browsers are normal, but IE garbled
------ Solution ------------------------- -------------------
receiving Chinese parameters need to be transcoded , or distortion is a matter
------ Solution - ------------------------------------------
About garbled, please refer to :
http://blog.csdn.net/lip009/article/details/1192022
------ Solution ---------------------------------------- ----
in your web.xml configuration:

encoding
org.springframework.web.filter.CharacterEncodingFilter

encoding
GBK



encoding
/ *

Note: You need to introduce spring frame package
------ Solution ----------------------------- ---------------
About garbled, please refer to:
http://blog.csdn.net/lip009/article/details/1192022


------ Solution ------------------------------------ --------
http://blog.csdn.net/lip009/article/details/1192022
------ Solution --------- -----------------------------------
http://topic.csdn.net/u/ 20120714/16/fda6564a-aea7-4a78-ab08-46942a351691.html

Two days ago I was asked to see if the same problem and you do not .
------ Solution ---------------------------------------- ----
html when submitting post and get methods
Import page after submission
<% @ page contentType = "text / html; charset = GBK"%>

<% request.setCharacterEncoding ("GBK");%> / / there is a role for the post to submit

submitted to the servlet
resquest.setCharacterEncoding ("GBK") is presented in a way to solve the Chinese garbled post questions must be written before the first parameter in the access

get way to solve the garbage problem , modify tomcat in sever.xml--> URLEncoding = "GBK"; in the server 's tags added


2: transcoding in the background
String deptNameSearch = request.getParameter ("deptNameSearch");
String str = new String (deptNameSearch.getBytes ("iso-8859"), "GBK");

3 configure a filter

encodingFilter
org.springframework.web.filter.CharacterEncodingFilter

encoding
UTF-8


forceEncoding
true



encodingFilter
/ *


------ For reference only ---------------------------------- -----
can choose to add filters, or each Action or Servlet must add transcoding
------ For reference only ------- --------------------------------
filters plus :

encodingFilter
org.springframework.web.filter.CharacterEncodingFilter

encoding
UTF-8


forceEncoding
true



encodingFilter
/ *

------ For reference only --------------------------- ------------
plus filter URL- Chinese also does not work.
------ For reference only -------------------------------------- -


URL Chuan Chinese garbled explanation here , please refer to
------ For reference only ------------------------ ---------------
url in mass Chinese needs to be transcoded to look at that article now ,
------ For reference only ----- ----------------------------------
  This reply was moderator deleted at 2012-07-19 13:29:52

------ For reference only ---------------------------------- -----
what server you use , tomcat or the other , if it is tomcat, you server.xml in the conf file under the connectionTimeout = "20000"
redirectPort = "8443"
disableUploadTimeout = "true" URIEncoding = "UTF-8" />
red position themselves need to add code to try
------ For reference only ------------------------ ---------------
way you do is get pass data without prior coding for the Chinese , it will pass directly over garbled
Solution:
into post submission , transfer data with the form , so no problem , with the get method is not acceptable
------ For reference only ----------- ----------------------------
on the garbage problem , there was still a unified set a filter in web.xml , once and for all , o (∩ _ ∩) o
------ For reference only ------------------------------- --------
/ / xmlhttp.send ("json =" + encodeURI (encodeURI (json))) ;/ / json.toJSONString ()
/ / action to receive data String json = request.getParameter ("json");
/ / json = URLDecoder.decode (json, "utf-8");
best way

没有评论:

发表评论