'编码函数
Public Function UTF8EncodeURI(szInput)
Dim wch, uch, szRet
Dim X
Dim nAsc, nAsc2, nAsc3
If szInput = "" Then
UTF8EncodeURI = szInput
Exit Function
End If
For X = 1 To Len(szInput)
wch = Mid(szInput, X, 1)
nAsc = AscW(wch)
If nAsc < 0 Then nAsc = nAsc + 65536
If (nAsc And &HFF80) = 0 Then
szRet = szRet & wch
Else
If (nAsc And &HF000) = 0 Then
uch = "%" & Hex(((nAsc \ 2 ^ 6)) Or &HC0) & Hex(nAsc And &H3F Or &H80)
szRet = szRet & uch
Else
uch = "%" & Hex((nAsc \ 2 ^ 12) Or &HE0) & "%" & _
Hex((nAsc \ 2 ^ 6) And &H3F Or &H80) & "%" & _
Hex(nAsc And &H3F Or &H80)
szRet = szRet & uch
End If
End If
Next
UTF8EncodeURI = szRet
End Function
Private Sub Command1_Click()
Dim a, b, c
a = "http://i.xiaoi.com/robot/webrobot?&callback=__webrobot_processMsg&data=%7B%22sessionId%22%3A%2229ad6f9398124ea3b097b8569c0aa158%22%2C%22robotId%22%3A%22webbot%22%2C%22userId%22%3A%224a9d9b312ac1410e98850eb2d78ef079%22%2C%22body%22%3A%7B%22content%22%3A%22"
b = "%22%7D%2C%22type%22%3A%22txt%22%7D"
c = a & UTF8EncodeURI("深圳天气") & b
'改上面的中文为对话的内容
WebBrowser1.Navigate (c)
End Sub