| Wap网站提交中文出现乱码,如何解决? | 作者:雪天 | 时间:2006-9-24 03:47:00 | | Wap网站提交中文出现乱码,如何解决?我刚开始接触Wap网站,在网上下了点资料,自己做了个电话号码的查询,所有的一切都能正常运行,可是在文本框中输入中文后再点搜索,返回的页面就不是搜索应该得到的页面,而是说没有找到。输入英文或数字都可以返回相应的正确的页面。程序如下:================index.asp===========<Response.ContentType="text/vnd.wap.wml"><?xmlversion="1.0"encoding="utf-8"?><!DOCTYPEwmlPUBLIC"-//WAPFORUM//DTDWML1.1//EN""[url=http://www.wapforum.org/DTD/wml_1.1.xml]http://www.wapforum.org/DTD/wml_1.1.xml[/url]"><wml><cardtitle="我的电话本"><p><inputname="search"maxlength="20"/><br/><anchor><gohref="search.asp?txt=$(search)"method="get"accept-charset="utf-8"></go>查询</anchor><br/><p>==============</p><ahref="search.asp">[全部]</a><br/><ahref="weather/">天气预报</a><br/><p>==============</p></p></card></wml>==============================================search.asp================<!--#includefile=conn.asp--><Response.ContentType="text/vnd.wap.wml"><?xmlversion="1.0"encoding="utf-8"?><!DOCTYPEwmlPUBLIC"-//WAPFORUM//DTDWML1.1//EN""[url=http://www.wapforum.org/DTD/wml_1.1.xml]http://www.wapforum.org/DTD/wml_1.1.xml[/url]"><wml><cardtitle="我的电话本"><p><txt=trim(replace(replace(request("txt"),"'",""),";",""))rs.source="select*fromcallBookwherefNamelike'"&txt&"'orfPhoneNumlike'"&txt&"'orfPhoneNum2like'"&txt&"'orderbyfName"rs.openrs.source,objcn,1,1dowhilenotrs.eofresponse.writechinese2unicode(trim(rs("fName")))&"<br/>"&trim(rs("fPhoneNum"))&"<br/>----------------<br/>"rs.movenextlooprs.closesetrs=nothingobjcn.closesetobjcn=nothing>==============<br/><ahref="search.asp">[全部]</a>|<ahref="index.asp">[返回]</a><br/>==============<br/></p></card></wml>================================================conn.asp================<dimobjcn,rssetobjcn=server.createobject("adodb.connection")objcn.connectionstring="provider=microsoft.jet.oledb.4.0;datasource="&server.mappath("phone.mdb")objcn.opensetrs=server.createobject("adodb.recordset")><functionchinese2unicode(Salon)dimidimSalon_onedimSalon_unicodefori=1tolen(Salon)Salon_one=Mid(Salon,i,1)Salon_unicode=Salon_unicode&chr(38)Salon_unicode=Salon_unicode&chr(35)Salon_unicode=Salon_unicode&chr(120)Salon_unicode=Salon_unicode&Hex(ascw(Salon_one))Salon_unicode=Salon_unicode&chr(59)nextchinese2unicode=Salon_unicodeendfunction>====================================请高手能给个正解。[b]最佳答案[/b]你用get方式提交会出错,改用POST就没问题了,如:<anchor>查询<gohref="search.asp"method="post"accept-charset="utf-8"><postfieldname="txt"value="$(search)"/></go></anchor>参考资料:[url=http://wap.kyeah.com]http://wap.kyeah.com[/url] |
|