Chinese Characters in Servlet
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Eddie_Yung
Posted On:   Saturday, March 23, 2002 12:17 AM

I've got problems in displaying Chinese Characters in my Servlet pages, I coded some Chinese characters within my 'out.println()' function within my Servlet class, ie:
out.println(" Chinese Characters ");

but it can't be displayed on the page, instead, just '????' displayed, I'm using Tomcat4.0, J2SDK1.4, I think that's the problem when generating the Servlet class, but could it be solved? anyone can help?? thanks a lot!!!!


Please use html tags to format code blocks.

Re: Chinese Characters in Servlet

Posted By:   vincent_hong  
Posted On:   Thursday, April 18, 2002 10:26 PM

Another simple way is, (though hardcoding some chinese character or other language-specified character in your code is not a good idea), just recompile the .java file with -encoding gb2312 or big5 in your case.

Re: Chinese Characters in Servlet

Posted By:   Rick_Noelle  
Posted On:   Monday, March 25, 2002 02:46 PM

I certainly wouldn't recompile! I'm also using Tomcat 4.0 and J2SDK1.4. I have a Japanese<->English dictionary utility. I'm using SJIS encoding to display Japanese. The key is in your

<%@page%>
tag. I use this:



<%@ page language="java" contentType="text/html; charset=SJIS"%>



You can do the same. Just replace SJIS with the Chinese encoding you are using. For a list of supported encodings, see

http://java.sun.com/j2se/1.4/docs/guide/intl/encoding.doc.html


Good Luck,
Rick

Re: Chinese Characters in Servlet

Posted By:   color_zhang  
Posted On:   Saturday, March 23, 2002 01:32 AM

There are many ways to solve this problem:

1.Recompile the source code of Tomcat4.0, replace the "ISO_8859" to "GBK"

2.Employ the helper method tansfer the string encoding from ISO8859 to GBK

3.Replace the Tomcat to BEA Weblogic with good I18N solution.

colorzhang@yeah.net
About | Sitemap | Contact