JSP pages of Chinese that the problem!
Abstract: JSP pages of Chinese that the problem!
In a JSP page, using the Java language to write some procedures, the Chinese have a String variable, this time with System.out.print showed that the Chinese String, no problem, and then the JSP pages in the form of a show String variables this time, when the variables for the general Chinese characters there is no problem, if this String variables for the 10 not uncommon word, such as "Lee" as "?", please master answers! Thank you
Gb2312 coding pages for all, if the importation of pages alone, "Chong", can be shown as "Chong"
GBK to look at the code
Will not be put in the database, the database may not understand?
Not stored to the database
Will be coded into the iso-8859-1 look at the bar,
Look at the code posts spread out
<% @ Page contentType = "text / html; charset = GB2312"%>
<% @ Page language = "java"%>
<% @ Page session = "true"%>
<% @ Page errorPage ="../ ExceptionErrorPage.jsp "%>
<% @ Page import = "java.util .*"%>
<% @ Page import = "com.cascc.avidm.dt.lib.utility.DateFormatter"%>
<% @ Page import = "com.cascc.platform.aa.org.user.UserData"%>
<% @ Page import = "com.cascc.platform.aa.org.ejb20 .*"%>
<% @ Page import = "com.cascc.platform.aa.AAContext"%>
<% @ Page import = "com.cascc.avidm.login.model.PersonModel"%>
<% @ Page import = "com.cascc.platform.domain.util.ServiceLocator"%>
<% @ Page import = "com.cascc.avidm.util.AvidmConstDefine"%>
<% @ Page import = "com.cascc.platform.aa.org.position.PositionData"%>
<%
String userid = "";
String username = "";
Try (
PersonModel person = (PersonModel) session.getAttribute ( "person");
Userid = person.getUserIID ();
Username = person.getUserName ();
System.out.println (username); / / Chinese shown here normal
) Catch (Exception e) ()
%>
<head>
<link> Rel = "stylesheet" type = "text / css" href ="../ css / avidm.css ">
</ Head>
<body>
<form Name="tran" method="get">
<Input type = "textt" name = "username" value ="<%= username %>">// shown here uncommon Chinese shown as "?"
</ Form>
</ Body>
Many of them have been introduced by its own category
Gb2312 is a relatively small set of characters, or by GBK utf-8 bar
"<% Username% =>" 10%
"<% = New String (username.getBytes (" GBK "));%>"
On the
Thank you, and even wanted to try, would come to the question!
Jsp pages in the document header with <% = request.setCharacterEncoding ( "gb2312")%>
Charset = pages you have changed charset = GB2312 GBK should be the
Learned, I am also encountered this problem now solved
OnlyFor_love (no to give me points on the landlord to cut several chick ')
Use your test methods, or will not do it?
Dlc_hot (), not the desire, to talk about the killing that solution
Too late
<% @ Page pageEncoding = "GB2312"%>
Try
OnlyFor_love (no to give me points on the landlord to cut several chick ') () Blue: 131 2006-08-18 14:30:00 points: 0
"<% Username% =>" 10%
"<% = New String (username.getBytes (" ISO8859-1 ")," GBK ");%>"
Can try this
"<% Username% =>" 10%
"<% = New String (username.getBytes (" ISO8859-1 ")," GBK ")%>"
After the semicolon expression not just wrong
Boss, "Chong" word is a traditional Chinese characters, can not write.
For example, "longå Ž" there is a time for the old name, you use normal five-stroke, you do not fight them.
In the database can be inserted into you, but if you want to use IE to show that it does not always show up.
I also encountered the same problem, depressed for a few days and finally had to help him change the name, or the landlord to change other characters. Users use of this word because it is very difficult played out. Finally had to do stop.
Experts do not know whether there are any good suggestions.
<% @ Page contentType = "text / html; GBK charset ="%>
<head>
</ Head>
Change like this and see us! Have you said the wrong reasons and gb2312 character sets include only common Chinese characters,
It is a subset of GBK!
Passing, friendship up!
<% Request.setCharacterEncoding ( "Try gb2312 ");%>
String username = new String (username.getBytes ( "ISO8859-1"), "GBK");
System.out.println ( "username:" + username);
Certain it is right, I just encountered this problem ..
Up
I also top up
In the top of the page for a command ah <% @ gb2312 page charset = "%> on jsp action can be solved by embedding the hash problem ah
There are several good ways to do ah
Right. Several idea is good. Study. . .
————————————————– ———————————-
100M.Net Mail space +50 M = 60 yuan / year
100M.Net top-level domains international space + = 100 yuan / international top-level domains. Com.net.cn = 50 yuan / year for domain names this site can be bundled free space 10 M Asp.Net
1000M.Net space + + 100M MsSql database 1000M Mail top-level domains = 600 + / enterprise database, complete machine rented post office Web site to promote the building of the United States Space web site are for sale there are many different packages available to the user layer.
Interested parties may contact Tel :021-64802212 Fax :021-64802212
Advisory mail: info@kingtoo.com Advisory OICQ: 68311305,379620139 81778640
Supervisor welcome spin gold from straw-net http://www.boxigroup.com web site development (j2ee. Net asp php javascript, c #, etc.) c / s Development (delphi, vb, vc, pb, cb) database development ( oracle, sqlserver, db2, access, mysql, Postgresql, informix), and other learning materials, hoping to meet the urgent needs of your resolve to make this website Favorites folder from time to time to prepare for the needs of bs + cs discussion groups (9638134)
Supervisor welcome spin gold from straw-net http://www.boxigroup.com web site development (j2ee. Net asp php javascript, c #, etc.) c / s Development (delphi, vb, vc, pb, cb) database development ( oracle, sqlserver, db2, access, mysql, Postgresql, informix), and other learning materials, hoping to meet the urgent needs of your resolve to make this website Favorites folder from time to time to prepare for the needs of bs + cs discussion groups (9638134)
GB2312
==>
GBK
GB18030
Ha ha ~ ~ ~ I have to top
Pages are encoded for gb2312
Thank you Bangding, the problem has been resolved!
Positive Solutions (not only) is: will be GBK charset!
XX 2!
↑ Back
Tags: java Chinese, JSP
Releated Java Articles
April 30, 2007 | Filed Under Java Server Pages |






