ZDNetChina中文社区 » 系统架构 » SaaS/S+S » websphere5.1 URL传递中文参数问题


2007-12-8 22:02 Exploit
websphere5.1 URL传递中文参数问题

服务器环境linux   as3+websphere5.1
我是在tomcat5。0编译然后移植到websphere5.1上的,在tomcat下可以通过配置conf下的server.xml中的
URIEncoding="GBK"解决URL传递中文参数问题,也就是如下所示:
<Connector   port="8888"       maxHttpHeaderSize="8192"   maxThreads="150"   minSpareThreads="25"   
maxSpareThreads="75"   enableLookups="false"   redirectPort="8443"   acceptCount="100"     
  connectionTimeout="20000"   disableUploadTimeout="true"     URIEncoding="GBK"/>
但是在websphere5.1上我就不知道了,在网上搜索说是按照如下设置:
在控制台里,选应用服务器--> 【你的应用服务器】--> 进程定义--> java虚拟机--> 一般JVM自变量,
然后输入:-Ddefault.client.encoding=GBK   -Dfile.encoding=GBK   
照着设置后发现还是不行,也试了其他的办法,还是没能解决,小弟以前没用过websphere,对websphere一点
都不熟,跪求各位大哥帮忙,小弟在这先谢谢了。

2007-12-8 22:02 icmp
websphere中决定使用哪种encoding过程如下
1.client.encoding.override设定了吗?
    yes-> 终了
    no-> 2
2.setCharacterEncoding()设定了吗?
    yes-> 终了
    no-> 3
3.request中Content-Type的charset有吗?
    yes-> 终了
    no-> 4
4.autoRequestEncoding=true设定了吗?(ibm-web-ext.xmi)
    yes-> 5
    no-> 6
5.根据request中language情报转换
  <WAS_root> /properties/encoding.properties
  <WAS_root> /properties/converter.properties
6.default.client.encoding设定了吗?
    yes-> 终了
    no-> ISO-8859-1

你已经在最后一步(6)做了设定,encoding指定上应该没问题。
所以确认以下两点
1,设定default.client.encoding后,重起Server了吗?
2,URLEncoding你是怎么用的?

String   newurl   =   URLEncoding(URL,"GBK");
encoding后的结果象下面这样,汉字变成了类似%2b%ed%2的东西
http://hostname:port/contextroot/test.jsp?name=%2b%ed%23

2008-10-25 16:54 webdirectory
String   newurl   =   URLEncoding(URL,"GBK");
encoding后的结果象下面这样,汉字变成了类似%2b%ed%2的东西
http://hostname:port/contextroot/test.jsp?name=%2b%ed%23

页: [1]


Powered by Discuz!  Archiver   © 2001-2006 Comsenz Inc.