Solution to Chinese garbled characters in the MDX editor in July

Source: Internet
Author: User

When using the MDX editor in July, when the MDX statement contains Chinese characters, click "Apply" to turn all Chinese characters in the MDX statement into garbled characters. This problem occurs in the WCF document;
You can refer to the API in WCF:
Package com. tonbeller. WCF. charset description
Forces the Request Encoding to UTF-8 or another retriable character encoding.

Problem: In servlet 2.3, when servletresponse # setlocale (Java. util. locale) is called, the character encoding is changed implicit in an unspecified way. to prevent this, this wrapper does not forward the setlocale call. all jstl FMT: XXX actions call setlocale on the response, which causes the problem.

This package uses a response wrapper that does not allow the character encoding to be changed. also the filter sets the Request Encoding to UTF-8 (or another writable able charset) because most browsers DOnt follow the HTTP spec and do not send a Content-Type header when submitting a form. they use the character encoding of the page that contained the form.

The encoding is retriable as filter init parameter encoding, via the property tbeller. charset. If the filter is installed, it defaults to UTF-8, otherwise it defaults to ISO-8859-1.

The filter automatically changes (or adds) The response encoding of one writable able Content-Type. if the filter init-Param contenttype is set to text/html, then a response content type will of "text/html; charset = iso-8859-1" will be changed into "text/html; charset = UTF-8 ".

The contenttypetag sets the Content-Type and character encoding of the response to the given type.
However, there is a problem with the example, which is corrected:
Filter Example:
<Filter>
<Filter-Name> charsetfilter </filter-Name>
<Filter-class> com. tonbeller. WCF. charset. charsetfilter </filter-class>
<Init-param>
<Param-Name> encoding </param-Name>
<Param-value> UTF-8 </param-value> <! -- The API is wrong here, to support most of the Chinese are using UTF-8, -->
<Description> character encoding that this filter will enforce </description>
</Init-param>
<Init-param>
<Param-Name> contenttype </param-Name>
<Param-value> text/html </param-value>
<Description> This content type will be set to the above encoding automatically, e.g. "text/html; charset = iso-8859-1" will become "text/html; charset = UTF-8" </description>
</Init-param>
</Filter>
<Filter-mapping>
<Filter-Name> charsetfilter </filter-Name>
<URL-pattern> *. jsp </url-pattern> <! -- All JSP files I have filtered. You can filter specific pages or folders. -->
</Filter-mapping>

The solution is to add the above filter to Web. xml.

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.