One of my programs, used in the background database MySQL, field is varchar,character set is UTF8, the field can and has been correctly stored in Chinese.
After extracting the information from the database, debug in the background Java code to see the correct Chinese.
However, through the Ajax way to send information to the foreground, the front desk display?? , a two question mark is also viewed with alert.
Look at the page encoding method, <%@ page contenttype= "text/html; Charset=utf-8 "%> and <meta charset=" Utf-8 "/> all have.
Go back to the deal in action and discover that there are three important treatments forgotten about response, which are:
Response.setcontenttype ("Text/xml;charset=utf-8");
Response.setheader ("Cache-control", "No-cache");
Response.setcharacterencoding ("UTF-8");
Put these three words in
PrintWriter out =getprintwriter (response);
I'll be right ahead of you.
That's all, I hope to be helpful to people who have the same problems as me.
January 9, 2017 15:52:37
About the back-end database normal storage Chinese through the Ajax way to the foreground into a question mark processing