比如将:%B1%C8%BF%A8%B3%AC
转换为中文有这段代码吗??

解决方案 »

  1.   

    试试:
    Public Function ascg(smsg As String) As String 
      Dim si, sb As Integer 
      Dim stmp As Integer 
      Dim stemp As String 
      sb = Len(smsg) 
      ascg = "" 
      For si = 1 To sb 
       stmp = AscW(Mid(smsg, si, 1)) 
       If Abs(stmp) < 127 Then 
       stemp = "00" & Hex(stmp) 
       Else 
       stemp = Hex(stmp) 
       End If 
       ascg = ascg & stemp 
      Next si 
      ascg = Trim(ascg) 
      End Function  
      

  2.   

    StrConv 函数的语法为:StrConv(待转换字串, 转换格式) 其中转换格式在这里用到的是: vbUnicode 将 Ansi 字串转换为 Unicode vbFromUnicode 将 Unicode 字串转换为 Ansi Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long 
    'GetWindowTextA' 指明这是一个非 Unicode API 以下是修改后的 API 声明: Declare Function GetWindowText Lib "user32" Alias "GetWindowTextW" (ByVal hwnd As Long, ByVal lpString As Long, ByVal cch As Long) As Long 
    'GetWindowTextW' 指明这是一个 Unicode API 由此可见,修改一个非 Unicode API 成为一个 Unicode API 的要点是: 
    * 把 Alias 里函数名的结尾 'A' 换成 'W'。 
    * 把所有 ByVal *** As String ,改为 ByVal *** As Long 。
      

  3.   

    不论中文英文在UNICODE中无非就是不同的编码值而以,你那几个例子可能编码值恰好落在中文页面,所以它们本身就代表了中文字符,你把它们显示出来就是中文,什么叫转化为中文?
      

  4.   

    function Decode(byval s as string) as string
        dim a() as string, b() as byte, i as long
        a = split(trim(s),"%")
        redim b(ubound(a))
        for i=0 to ubound(a)
            b(i) = cbyte("&H" & a(i))
        next
        Decode = StrConv(b, vbUnicode)
    end function
    '== Immediate ==
    ?Decode("%B1%C8%BF%A8%B3%AC")
    比卡超