The above code can be passed in Chinese normally in FF/Chrome, but in IE, there is a problem, and the information output in the background is garbled.
Problem attempt:
1. Set contentType: "text/plain; charset=utf-8", the problem persists
2. I rechecked the JSP page where the ajax code is located, all of which use UTF-8, but the problem persists
3. In the Java code in the background, the encoding conversion of UTF-8, GBK, and GB2312 is forced, and the problem persists
After analysis, it is determined that it may be related to the transmission of content in the browser or JQuery, but it cannot be accurately determined at this time.
Solution:
Previous paragraph: encodeURI($(dom).val(), "UTF-8"); encode with encodeURI
Backend Java code:
URLDecoder.decode(inputStr, "UTF-8"): The backend code decodes the string passed in the front segment.
Summary:
Finally, the string information passed by the Ajax Post request can be displayed normally, and the Chinese can be displayed normally.
|