msinet.ocx 在ie7 下面使用OpenUrl方法获取汉字文件,出错了,同样的程序在ie6、ie5下都可以正常的执行。看服务器上的提示日志,好像提交的汉字都变为一串无法解读的字符了,有%,a,b,3等等的一些字符组成。这个要如何避免啊?

解决方案 »

  1.   

    提交的汉字是要变成%,a,b,3等等的一些字符啊!ie几都是
      

  2.   

    url编码
    就是把url使用下边函数编码
    Public Function URLencode(vstrin)
        Dim i, strreturn, strSpecial, t
        strSpecial = " <>""#%{}|^~[]`'&?+" & Chr(13) & Chr(10)
        strreturn = ""
        For i = 1 To Len(vstrin)
            thischr = Mid(vstrin, i, 1)
            If Abs(Asc(thischr)) < &HFF Then
                If InStr(strSpecial, thischr) > 0 Then
                    If thischr = " " Then
                      strreturn = strreturn & "+"
                    Else
                      t = hex(Asc(thischr))
                      If Len(t) = 1 Then t = "0" & t                      strreturn = strreturn & "%" & t
                    End If
                Else
                    strreturn = strreturn & thischr
                End If
            Else
                innercode = Asc(thischr)
                If innercode < 0 Then
                    innercode = innercode + &H10000
                End If
                hight8 = (innercode And &HFF00) \ &HFF
                low8 = innercode And &HFF
                strreturn = strreturn & "%" & hex(hight8) & "%" & hex(low8)
            End If
        Next
        URLencode = strreturn
    End Function