Chinese garbled in SSH

Source: Internet
Author: User
Http://wenwen.soso.com/z/q171226418.htm
Solve garbled several small points:
1. Configure the filter, you can choose to write yourself, since you use the SSH framework is simpler, directly with spring filter, web.xml configuration can be.

2.JSP Page Setup code, all places have to be the same, I used to use GBK
<%@ page contenttype= "TEXT/HTML;CHARSET=GBK"%>
You can also use HTML for page encoding configuration
<meta http-equiv= "Content-type" content= "text/html; CHARSET=GBK ">

3. Configure Tomcat (we use, another server to find) code
Configured in Server.xml, such as:
<connector port= "8080" maxhttpheadersize= "8192"
maxthreads= "minsparethreads=" maxsparethreads= "75"
Enablelookups= "false" redirectport= "8443" acceptcount= "100"
connectiontimeout= "20000" disableuploadtimeout= "true" uriencoding= "GBK"/>

4. If there are garbled, can only use this trick, I rarely use
New String (S.getbytes ("iso-8859-1"), "GBK")

Generally use form to submit the first two ways will not appear garbled, with GET request, after the URL appended to the first two Chinese parameters regardless of the need to configure Tomcat or the fourth type, recoding
Questioner's questioning 2009-12-22 22:54 I used to use the "UTF-8" I also added a filter, as you configure the above but still garbled


I wonder why in some places can not be garbled in some places is garbled


And I used the MySQL database is now the database is garbled in other machines on the database data is not garbled



How do you explain that?
Answer person's supplement 2009-12-22 23:04 I'm not quite sure, I'm a novice. That's what I've been searching for on the internet. Give you this URL: http://www.busfly.cn/post/luanma-pom-java.html You see if I can help you

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.