-
1. Re: questions on migration from websphere to jboss3.0(charse
hansbaus Dec 26, 2002 6:23 AM (in response to tsingt)I think this is not a JBOSS problem, but anyway...
Have you set the content-type of the page to gb2312?
The default is 'iso-8859-1' but you can change that:
Within the add
<meta HTTP- EQUIV="content- type"
CONTENT="text/html; CHARSET=gb2312">
Maybe it is also possible to change the default of the servlet container.
Hans Bausewein -
2. Re: questions on migration from websphere to jboss3.0(charse
hansbaus Dec 26, 2002 7:39 AM (in response to tsingt)Check http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletRequest.html#setCharacterEncoding(java.lang.String)
setCharacterEncoding
public void setCharacterEncoding(java.lang.String env)
throws java.io.UnsupportedEncodingException
Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input using getReader().
Parameters:
a - String containing the name of the chararacter encoding.
Throws:
java.io.UnsupportedEncodingException - if this is not a valid encoding
so you set the request's encoding once in the start of the page and then all req.getParameter() calls will return the data in that encoding.
But I think most server containers also offer a way to change the default encoding. -
3. Re: questions on migration from websphere to jboss3.0(charse
tsingt Dec 26, 2002 8:35 PM (in response to tsingt)Hi, Hansbaus
Thank you for your reply.:)
I do add this sentence in my file:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
But it still can not work.
I have checked the webpage you mentioned.I think maybe
I can use setCharacterEncoding() to set the charset to
"gb2312".But it still need some additional coding work,
and I even do not know how to use setCharacterEncoding().
I agree that most web containers should offer a way to
change the default request encoding. But where is the
way for JBoss? :) Can you tell me?
Thanks again.
tsingt -
4. Re: questions on migration from websphere to jboss3.0(charse
tsingt Dec 26, 2002 10:22 PM (in response to tsingt)Hi, Hansbaus
I have seen this page:
http://w6.metronet.com/~wjm/tomcat/2001/Aug/msg00215.html
It gives some useful information.
but how can i set the requestEncoding parameter?
tsingt -
5. Re: questions on migration from websphere to jboss3.0(charse
hansbaus Dec 27, 2002 11:17 AM (in response to tsingt)JBOSS uses Jetty (http://jetty.mortbay.org/jetty/index.html) as the default servlet container, so try there.
This message in 'HTTPD, Servlets & JSP'
http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ that Jetty does not support to specify character encodings, so maybe you must use Tomcat.
You can use different servlet containers with JBOSS, though. I like Resin (http://www.caucho.com). -
6. Re: questions on migration from websphere to jboss3.0(charse
tsingt Jan 1, 2003 8:07 PM (in response to tsingt)I use tomcat now.But I still do not know how to
specify character Encoding for it. -
7. Re: questions on migration from websphere to jboss3.0(charse
clarkcb Feb 2, 2003 3:54 PM (in response to tsingt)The meta content-type tag with encoding defined -
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- indicates to the browser what encoding the content should be displayed for, but you should also include the following at the very top of your JSP:
<%@ page language="java" pageEncoding="gb2312" contentType="text/html;charset=gb2312" %>
Please note that I am testing this in JBOSS/Jetty right now, but I've had success using this with Tomcat (no JBOSS), so I think this should work. (I'll give an update here if I find anything else out.)