UPrivate Declare Function MultiByteToWideChar Lib "kernel32" (ByVal v_lCodePage As Long, ByVal v_lFlags As Long, ByVal v_lMultiByteStr As Long, ByVal v_lMultiByte As Long, ByVal v_lWideCharStr As Long, ByVal v_lWideChar As Long) As Long Private Declare Function WideCharToMultiByte Lib "kernel32" (ByVal v_lCodePage As Long, ByVal v_lFlags As Long, ByVal v_lWideCharStr As Long, ByVal v_lWideChar As Long, ByVal v_lMultiByteStr As Long, ByVal v_lMultiByte As Long, ByVal v_lDefaultChar As Long, ByVal v_lUsedDefaultChar As Long) As Long Private Const CP_ACP = 0 Private Const CP_UTF8 = 65001 Public Function UTF8_Decode(ByVal v_sText As String) As String     Dim sBuffer As String 'Decoded string buffer     Dim lLength As Long 'Length of buffer     v_sText = StrConv(v_sText, vbFromUnicode)     'Get the length first     lLength = MultiByteToWideChar(CP_UTF8, 0, StrPtr(v_sText), -1, 0, 0)     sBuffer = Space$(lLength)     lLength = MultiByteToWideChar(CP_UTF8, 0, StrPtr(v_sText), -1, StrPtr(sBuffer), Len(sBuffer))     UTF8_Decode = Left$(sBuffer, lLength - 1) End Function Public Function UTF8_Encode(ByVal v_sText As String) As String     Dim sBuffer As String 'Encoded string buffer     Dim lLength As Long 'Length of buffer     'Get the length first     lLength = WideCharToMultiByte(CP_UTF8, 0, StrPtr(v_sText), -1, 0, 0, 0, 0)     sBuffer = Space$(lLength)     lLength = WideCharToMultiByte(CP_UTF8, 0, StrPtr(v_sText), -1, StrPtr(sBuffer), Len(sBuffer), 0, 0)     sBuffer = StrConv(sBuffer, vbUnicode)     UTF8_Encode = Left$(sBuffer, lLength - 1) End Function