Encoding charset problem in client browser for RC2
caigao Jun 4, 2005 10:29 PMhi, all.
I am trying to translate the Resource file into Chinese, then i meet a question.
My env is:
windows xp (same problem as Redhat Linux AS 4.0)
jdk1.5.0
jboss 4.0.2
jboss portal 2.0 RC2 src build
hsqldb (mysql in redhat as4)
i have trying to do every following changes:
1.
modify "core\src\resources\portal-core-war\WEB-INF\portal.xml"
and change "<mime-type>text/html</mime-type>"
to "<mime-type>text/html;charset=gb2312</mime-type>"
2.
same as above but changes to
"<mime-type>text/html;charset=gbk</mime-type>"
3.
"<mime-type>text/html;charset=utf-8</mime-type>"
4.
modify "portlet\src\main\org\jboss\portal\portlet\impl\RenderResponseImpl.java"
change to
public void setContentType(String contentType) { String cs = contentType; int index = contentType.indexOf(';'); System.out.println("-----------contentType:"+cs); //result is always "text/html" if (index != -1) { contentType = contentType.substring(0, index); } String responseContentType = resp.getContentType(); System.out.println("--------responseContentType:"+responseContentType); //result is always "text/html" if (!responseContentType.equals(contentType)) { throw new IllegalArgumentException("Content type not accepted"); } //result.setContentType(contentType); result.setContentType("text/html;charset=gb2312"); }
5.
modify theme index file: "core\src\bin\portal-core-war\nodesk\index.jsp"
change ""
to "<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="gbk">"
6.
modify theme index file: "core\src\bin\portal-core-war\nodesk\index.jsp"
change '<meta http-equiv="Content-Type" content="text/html" />'
to '<meta http-equiv="Content-Type" content="text/html;charset=gbk" />'
or '<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />'
================================
i do these changes per time and make build clean build deploy and restart jboss AS.
but every time the IE explorer give me the wrong answer like half top of the given image. I must select IE menu "view-->Encoding-->Chinese GB2312" to get correct result just like half bottom of the attach image.
somebody can give the right answer? how can i do?
thank you.
[img]http://www.emig.cn/jbportalencodingerror.jpg[/img]