Solutions to URL-based Japanese character garbled characters

Source: Internet
Author: User

Garbled text has always been a headache for many programmers. Many articles on Garbled text have been introduced in this article and do not need to be cumbersome.
The basic concepts are as follows:
Http://www.tingko.net/School/java/20139.html
Http://www.tingko.net/School/java/20140.html
The description is clear and provides a solution, which is helpful for the system to master the coding problem.

This article focuses on Windows:

In Tomcat + Struts + JSP mode, the URL is garbled in Japanese.

The solution adds uriencoding to server. xml.

<Connector
Port = "8080" maxthreads = "150" minsparethreads = "25" maxsparethreads = "75"
Enablelookups = "false" redirectport = "8443" acceptcount = "100"
DEBUG = "0" connectiontimeout = "20000"
Disableuploadtimeout = "true"Uriencoding = "Windows-31J"
/>

However, if this change is effective in Linux, experiments are required.

How to configure and solve the Garbled text in WebSphere is further discussed. This article is first put here for reference.

// ===================================2007/02/13 append ======================== =
What should I do with WebSphere?

The server uses ISO-8859-1 encoding to process URLs,
This will naturally cause problems. The solution is to use the startup parameters of the server JVM,
Add-duser. Language = ZH-duser. region = cn-dfile. Encoding = UTF-8-dclient. Override. Encoding = UTF-8 to set.
This does not seem to be a good solution because it is too dependent on the server configuration and is deployed on different servers,
Inconsistent results may occur. Therefore, this problem should be avoided as much as possible.

Some people say:
You only need to use the urlencode () function of JavaScript on the page to encode the URL first.

I tried, in the Tomcat environment, using only string ustr1 = urlencoder. encode (STR, "Windows-31J") does not work.

 

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.