Encoding Problems-there are three types of codes (page encoding, file format encoding, and backend encoding)

Source: Internet
Author: User

Click draft box ----> (select a time period) to query
GET/hnmms/seachsms. do? Method = getsmsbytime & starttime = & endtime = & boxnum = 0 & smssender = http/1.1
HOST: localhost: 8077
User-Agent: Mozilla/5.0 (windows; U; Windows NT 5.1; ZH-CN; RV: 1.9.2.13) Gecko/20101203 Firefox/3.6.13
Accept: Application/JSON, text/JavaScript ,*/*
Accept-language: ZH-CN, ZH; q = 0.5
Accept-encoding: gzip, deflate
Accept-charset: gb2312, UTF-8; q = 0.7, *; q = 0.7
Keep-alive: 115
Connection: keep-alive
X-requested-with: XMLHttpRequest
Referer: http: // localhost: 8077/hnmms/New/index. jsp
COOKIE: JSESSIONID = 9ef8124bb8f707ca027fda-b1803269b

-----> Garbled Information)
HTTP/1.1 200 OK
Server: APACHE-Coyote/1.1
Content-Type: text/html; charset = UTF-8
Transfer-encoding: chunked
Date: Tue, 08 mar 2011 09:16:29 GMT

BF
[{"Smsid": 6, "smstopic": "zengxi", "smscontent": "", "smsids": "", "smstype ":"", "smssender": "", "smsreceivephone": "32432432424", "smsreceiver": "fear", "smstime": "", "smsstatus": 0}]
0

 

Background log:
--> Conn: COM. MySQL. JDBC. Connection @ 11e98f4
Select * From a_sms where smstime between '2017-03-01 'and '2017-03-09' and smsstatus = 0 and smssender = ''order by smsid DESC
--> Release connn over
[{"Smsid": 6, "smstopic": "zengxi", "smscontent": "", "smsids": "", "smstype ":"", "smssender": "", "smsreceivephone": "32432432424", "smsreceiver": "hier", "smstime": "", "smsstatus": 0}]

 

 

The solution is: three encoding is unified and all are handled in UTF-8.

 

Set the project first

Set the -- JSP encoding format, or delete it. modify it in notepad and save it as JSP UTF-8.

When processing is finally accepted, set the next character

Request. setcharacterencoding ("UTF-8 ");
Response. setcharacterencoding ("UTF-8 ");

 

Last OK

 

 

Record it. I think this is the purpose of the Interceptor. There are too many things to learn. J2EE is not simple.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.