Excel 如何在vba中解码%C3%B8
如何在VBA中解码%C3%B8?这是丹麦字母ø- 它是用UTF-8编码的。我曾尝试在vba中对其进行解码,以便在excel sppreadsheet中使用,并具有以下功能:Excel 如何在vba中解码%C3%B8,excel,vba,Excel,Vba,如何在VBA中解码%C3%B8?这是丹麦字母ø- 它是用UTF-8编码的。我曾尝试在vba中对其进行解码,以便在excel sppreadsheet中使用,并具有以下功能: Function DecodeUTF8(s) Dim i Dim c Dim n i = 1 Do While i <= Len(s) c = Asc(Mid(s, i, 1)) If c And &H80 Then n = 1 Do While i
Function DecodeUTF8(s)
Dim i
Dim c
Dim n
i = 1
Do While i <= Len(s)
c = Asc(Mid(s, i, 1))
If c And &H80 Then
n = 1
Do While i + n < Len(s)
If (Asc(Mid(s, i + n, 1)) And &HC0) <> &H80 Then
Exit Do
End If
n = n + 1
Loop
If n = 2 And ((c And &HE0) = &HC0) Then
c = Asc(Mid(s, i + 1, 1)) + &H40 * (c And &H1)
Else
c = 191
End If
s = Left(s, i - 1) + Chr(c) + Mid(s, i + n)
End If
i = i + 1
Loop
DecodeUTF8 = s
End Function
功能解码utf8(s)
昏暗的我
dimc
暗淡的
i=1
当i时,您必须使用UrlDecode或HmlDecode方法
有关更多信息,请参见此处
还是在这里
你得到了什么结果(你期待什么)?您是否尝试过单步执行此代码,以查看它与您期望的不同之处?