When a JSP parameter is passed today, Chinese characters are garbled and added on the page
Code:
- <% @ Page Language = "Java" contenttype = "text/html; charset = UTF-8"
- Pageencoding = "UTF-8" %>
- <% Request. setcharacterencoding ("UTF-8"); %>
The Chinese characters are displayed normally.
Recently, I changed some default encoding settings of myeclipse, which always produces Chinese garbled characters, causing my headache. I am going to study it.
------------------------------
Http://blog.163.com/luyufen_luise/blog/static/5777392520103132253440/
The above website shows a method to configure the filter. You only need to configure the Web. xml file to solve Chinese garbled characters on the page.
Open the Web. xml file under the WEB-INF directory and add the following:
Code:
- <Filter>
- <Filter-Name> encodingfilter </filter-Name>
- <Filter-class>
- Org. springframework. Web. Filter. characterencodingfilter
- </Filter-class>
- <Init-param>
- <Param-Name> encoding </param-Name>
- <Param-value> UTF-8 </param-value>
- </Init-param>
- </Filter>
- <Filter-mapping>
- <Filter-name> encodingFilter </filter-name>
- <Url-pattern>/* </url-pattern>
- </Filter-mapping>
The configuration in this section uses the filters in the jar package of spring to process Chinese garbled characters, which is convenient and practical. I hope to help the technical staff with relevant problems!
If you do not use the spring jar package, you need to write the filter yourself.
Related Articles:
Http://applelini.blog.163.com/blog/static/98652780201001425758226? Fromdm & fromsearch & isfromsearchengine = Yes
Http://chenmingming2000.blog.163.com/blog/static/2000687520094223110187? Fromdm & fromsearch & isfromsearchengine = Yes
Http://applelini.blog.163.com/blog/static/98652780201001425758226? Fromdm & fromsearch & isfromsearchengine = Yes