Wildfly8 POST request Chinese garbled analysis and solution, wildfly8 Chinese

Source: Internet
Author: User

Wildfly8 POST request Chinese garbled analysis and solution, wildfly8 Chinese

Recently, I encountered a problem about Chinese garbled characters in POST requests. The original application was running on TOMCAT. After switching to Wildfly8, the test environment was normal, however, in the production environment, garbled characters are generated on the server for the same request sent by the client. After locating the request, it is found that it is caused by a configuration of Wildfly8.

The problem is analyzed as follows:

In the http post request, if this is the case, Content-Type: application/x-www-form-urlencoded; charset = UTF-8, if charset = UTF-8 is not set, in this case, the request parameters may contain Chinese Characters in garbled characters. For details, see the Servlet container configuration. In TOMCAT, if useBodyEncodingForURI = "true, the Request will be decoded using UTF-8 when parsing the Request body parameters, and no garbled characters will appear. If useBodyEncodingForURI = "false", Chinese garbled characters will appear; configurations with the same role in Wildfly are available in Configuration-> Web-> Servlets-> Common-> Default encoding. If Default encoding is set to UTF-8, Chinese garbled characters are not displayed. If it is set to null, chinese characters are displayed. Garbled, the container by default is the use of ISO 8859-1 decoding, for POST requests encoded with UTF-8, Chinese decoding error, English and numbers are not affected.

Chinese garbled Configuration


Set the default codec mode configuration


The official configuration definition is as follows:


Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.