out.print(outWML.outHref(DefaultURL+"free.jsp?name=假使我漂亮-jade关心妍", "假使我漂亮(jade关心妍)"));
这句,我将一个中文参数传递到free.jsp页面


free.jsp
<% response.setContentType( " text/vnd.wap.wml;charset=UTF-8 " ); %>
<% @ page import = " Comm.outWML " %>
<% @ page import = " Comm.GB2U " %>

<? xml version = " 1.0 "   ?>
<! DOCTYPE wml PUBLIC  " -//WAPFORUM//DTD WML 1.1//EN "   " http://www.wapforum.org/DTD/wml_1.1.xml " >
< wml >
    
< head >
        
< meta http - equiv = " Cache-Control "  content = " max-age=0 "  forua = " true " />
    
</ head >

    
< card id = " main "  title = " <%=Comm.GB2U.gb2u( " 劲歌金曲爬行榜 " )%> " >
        
<% @ include file = " mobinfo.inc "   %>
        
<% @ include file = " module.inc "   %>
        
<%
           String para 
=   new  String(request.getParameter( " name " ).getBytes( " iso8859_1 " ));
           out.print(
" <p> " + para + " </p> " );//输出获得的参数,都为乱码
           out.print(outWML.outHref(DefaultURL
+ " mring.jsp " ,   " 劲歌金曲爬行榜首页 " ));
           out.print(monternet);
        
%>
    
</ card >
</ wml >

出来的结果怎么都是乱码

是关于java的,java的默认参数传递方式是utf8码,今天终于解决了
不是楼上说的问题
在发送url请求的页面和接收url请求的页面做如下设置
<%response.setContentType("text/vnd.wap.wml;charset=UTF-8");%>//utf8
<%request.setCharacterEncoding("UTF-8");%>//参数处理方式utf8
<%@ page pageEncoding="ISO-8859-1"%>//页面字符处理方式 iso-8859-1

 
o?按照ISO-8859-1传递就行了?我怎么记得也会出问题呢?过网关的时候也会出点莫名其妙的事情。

我是都urlencode了,然后替换一下%,然后程序再解码。
2004-07-08 09:05 | virushuo

 

呵呵,普通的传递用urlencode.class,解码用urldecode.class
表单的传递用iso-8859-1就可以了,呵呵

以上是指移动的wap业务,所有汉字编码必须是utf8的情况下