Hi All,
Am having trouble decoding URL-safe Cyrillic characters back to Cyrillic.
e.g.
is
Тюменская область
The javascript fuction decodeURIComponent works fine (check the URL decoder on meyerweb)
however I can't manage to find a VBA equivilent. The following works for your standard A-Z, but not for the above.
Any ideas?
Many thanks
Katerina
Am having trouble decoding URL-safe Cyrillic characters back to Cyrillic.
e.g.
Code:
%D0%A2%D1%8E%D0%BC%D0%B5%D0%BD%D1%81%D0%BA%D0%B0%D1%8F%20%D0%BE%D0%B1%D0%BB%D0%B0%D1%81%D1%82%D1%8C
Тюменская область
The javascript fuction decodeURIComponent works fine (check the URL decoder on meyerweb)
however I can't manage to find a VBA equivilent. The following works for your standard A-Z, but not for the above.
Any ideas?
Many thanks
Katerina
Code:
Public Function URLDecode(StringToDecode As String) As String
Dim TempAns As String
Dim CurChr As Integer
CurChr = 1
Do Until CurChr - 1 = Len(StringToDecode)
Select Case Mid(StringToDecode, CurChr, 1)
Case "+"
TempAns = TempAns & " "
Case "%"
TempAns = TempAns & Chr(Val("&h" & _
Mid(StringToDecode, CurChr + 1, 2)))
CurChr = CurChr + 2
Case Else
TempAns = TempAns & Mid(StringToDecode, CurChr, 1)
End Select
CurChr = CurChr + 1
Loop
URLDecode = TempAns
End Function
Last edited: