sheilacolbert

September 16, 2010

Chinese garbled in JSP programming solution to the problem

Filed under: Uncategorized

JSP ordinary Chinese people to be terribly upset garbage problem, particularly in the primary entry for JSP programming enthusiasts even know what to do.

JSP Chinese processing for common measures can often be seen on the Internet is mainly the following two kinds:

< % @ Page contentType = "text / html; charset = gb2312"%>

Or:

< % String Hi = "Hello"; byte [] tmpbyte = Hi.getBytes ("ISO8859_1"); Hi = new String (tmpbyte); out.print (Hi);%>

Virtual Small Dragon Pavilion is also mainly the above two kinds of methods were modified to become a 1.1 version.

A simple summary of the example JSP Chinese garbage problems in the following areas:

??Chinese in the URL with parameters, can be directly read.

For example:

< % = Request.getParameter ("showword")%>

??sql database relevant to the operation

Here the use of Access without problems.

??read HTML

form submitted in the form of Chinese values

Need to be encoded in jswdk the more concise wording such as:

String name1 = new String (request.getParameter (”user_id”). GetBytes (”ISO8859_1″));

In addition, jdk1.3 support, do not join

< % @ Page contentType = "text / html; charset = gb2312"%>

In jdk1.2.2 below, even if the two kinds of methods used at the same time is also very unstable.

In the resin platform, the situation is better. As long as the first line of the page by adding:

< % @ Page contentType = "text / html; charset = gb2312"%>

JSP can correctly handle the issue of Chinese garbage.

If we add the code then it does not.

??session included the Chinese

In jswdk, the strange thing is, if read from the form of encoded values can be displayed correctly;

However, given directly to Chinese values are not.

resin platform well, ibid.

??Chinese values for the variables assigned after the display Chinese correctly.

For example, the following procedures:

< % @ Page contentType = "text / html; charset = gb2312"%> < % String Hi = "Hello"; byte [] tmpbyte = Hi. getBytes ("ISO8859_1"); Hi = new String (tmpbyte); out.print (Hi);%>

Also jswdk1.0.1, above representation is not the problem in jdk1.2.2, but it can not be displayed under jdk1.3.

resin platform well, ibid, tested, only the make up in

Without

< % @ PagecontentType = "text / html; charset = gb2312"%>

Can also display Chinese correctly.

Experience:

jswdk may only be used for general development, stability and other issues may not be as commercial software.

As the jdk1.3 version many times better than those jdk1.2.2, and also better support for Chinese, so it should be used.

De commercial software as a free, resin not only speed fast, stable, automatic compilation, Ke Zhi Chu error OK, can the server side Zhichishiyong javascript, etc., but, at least I Juede on the Chinese's Zhichi good.

Of course, if you can not do anything to avoid dealing with the Chinese garbled JSP issue will be what we expect.

Also, I believe in the unix / linux / solaris should under no such problem.

????:

3G the first number up to the “special” user

Simple Help Tools

Quicktime Swf

rmvb to dvd

Firefox In Hidden Page 7

My favorite Development

The new second generation of new ID card readers

Brief Kids Education

Storage Hobby

The budget system is inadequately prepared elder Wu

DELPHI beginners reference (b)

A large number of international giants fight back to the Chinese. CN domain names

. Net-based learning: Dynamic menu

Mkv

WAV converter

The Founding of sailing

Comments »

The URI to TrackBack this entry is: http://sheilacolbertgb.blogsome.com/2010/09/16/chinese-garbled-in-jsp-programming-solution-to-the-problem/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.






















Get free blog up and running in minutes with Blogsome
Theme designed by Hermanitos Verdes