就 20 分了,紧急简单问题,关于 urlencode()
我用 httputility.urlencode() 对汉字编码来传递参数.
得到的路径是:
KuaiQianSend.asp?merchant_id=888888&mac=888888&orderid=071231101425&amount=70&curr=1&isSupportDES=2&merchant_url=http://localhost/lottery/Lottery_NetPayStep2.aspx&pname=%e9%83%91%e6%b5%b7%e6%bb%a8&commodity_info=%e5%bd%a9%e7%a5%a8%e9%a2%84%e4%bb%98%e6%ac%be&merchant_param=0&pemail=zhenghaibingood@eyou.com
主要看这里:
&pname=%e9%83%91%e6%b5%b7%e6%bb%a8&commodity_info=%e5%bd%a9%e7%a5%a8%e9%a2%84%e4%bb%98%e6%ac%be&merchant_param=0
我想要的是三个参数: pname, vcommodity_info, vmerchant_param;
在 kuaiqiansend.asp 中使用:
pname = request.QueryString( "pname ") ' ' '支付人姓名
commodity_info = request.QueryString( "commodity_info ") ' ' '商品信息
merchant_param = request.QueryString( "merchant_param ") ' ' '商户私有参数
接收,可是得到的却是:
付款人姓名: 郑海�?commodity_info=彩票预付�?merchant_param=0
商品描述:
我希望的是:
付款人姓名: 郑海滨
商品描述: 彩票预付款
以及:merchant_param=0
------解决方案--------------------接收的时候Decode
------解决方案--------------------pname = Server.UrlDecode(request.QueryString( "pname ")) ' ' '支付人姓名
commodity_info = Server.UrlDecode(request.QueryString( "commodity_info ")) ' ' '商品信息
merchant_param = Server.UrlDecode(request.QueryString( "merchant_param "))
------解决方案--------------------你是aspx到 asp?
这样的话你用JS的escape进行编码吧
------解决方案--------------------asp没有decode,网上帮你找了一个
Function URLDecode(sConvert)
Dim aSplit
Dim sOutput
Dim I
If IsNull(sConvert) Then
URLDecode = " "
Exit Function
End If
' convert all pluses to spaces
sOutput = REPLACE(sConvert, "+ ", " ")
' next convert %hexdigits to the character
aSplit = Split(sOutput, "% ")
If IsArray(aSplit) Then
sOutput = aSplit(0)
For I = 0 to UBound(aSplit) - 1
sOutput = sOutput & _
Chr( "&H " & Left(aSplit(i + 1), 2)) &_
Right(aSplit(i + 1), Len(aSplit(i + 1)) - 2)
Next
End If
URLDecode = sOutput
End Function
------解决方案--------------------asp 可以用 unescape()的