显示在网页地址栏的中文怎么才能转换啊?
在一个地址栏里的“%D3%CE%CF%B7”这个字符,表示中文“游戏”,那我应该如何把“游戏”这个词通过VB转换成“%D3%CE%CF%B7”呢,还有其他中文又是该如何转换呢?谢谢!
[解决办法]
参阅这个:
- VB code
ption ExplicitPrivate Sub Command1_Click() Dim bArr() As Byte Dim strByte() As String Dim sMe As String Dim intP As Integer If Text2.Text = "" Then Exit Sub strByte = Split(Text2.Text) For intP = LBound(strByte) To UBound(strByte) strByte(intP) = CStr(Val("&H" & strByte(intP))) Next intP ReDim bArr(UBound(strByte) - LBound(strByte) + 1) For intP = LBound(strByte) To UBound(strByte) bArr(intP) = Val(strByte(intP)) Next intP sMe = StrConv(bArr, vbUnicode) Text1.Text = sMeEnd SubPrivate Sub Command2_Click() Dim intP As Integer Dim uniByte() As Byte If Text1.Text = "" Then Exit Sub uniByte = StrConv(Text1.Text, vbFromUnicode) Text2.Text = "" For intP = LBound(uniByte) To UBound(uniByte) Text2.Text = Text2.Text & Right("00" & Hex(uniByte(intP)), 2) & " " Next intP Text2.Text = Left(Text2.Text, Len(Text2.Text) - 1)End SubPrivate Sub Form_Load() Text1.Text = "游戏"End Sub