Private Const CP_UTF8 = 65001
Private Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpMultiByteStr As String, ByVal cchMultiByte As Long, ByVal lpWideCharStr As String, ByVal cchWideChar As Long) As Long
Function ConvertUTF8(UTF8 As String) As String
Dim lLen As Long
Dim strOut As String
lLen = MultiByteToWideChar(CP_UTF8, 0, UTF8, Len(UTF8), 0, 0)
strOut = String(lLen * 2, 0)
MultiByteToWideChar CP_UTF8, 0, UTF8, Len(UTF8), strOut, lLen
ConvertUTF8 = StrConv(strOut, vbFromUnicode)
End Function
|