par
Invité » 24 nov. 2010, 11:57
Merci de répondre
J'ai essaye entre autres, pris sur codeyx
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 Long, ByVal cchWideChar As Long) As Long
Private Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByVal lpMultiByteStr As String, ByVal cchMultiByte As Long, ByVal lpDefaultChar As Long, ByVal lpUsedDefaultChar As Long) As Long
Public Function AToUTF8(ByVal wText As String) As String
Dim vNeeded As Long
Dim vSize As Long
vSize = Len(wText)
vNeeded = WideCharToMultiByte(CP_UTF8, 0, StrPtr(wText), vSize, "", 0, 0, 0)
AToUTF8 = String(vNeeded, 0)
WideCharToMultiByte CP_UTF8, 0, StrPtr(wText), vSize, AToUTF8, vNeeded, 0, 0
End Function
Mais "a" me retourne une chaine vide.
Je dois certainement me planter
Merci de répondre
J'ai essaye entre autres, pris sur codeyx
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 Long, ByVal cchWideChar As Long) As Long
Private Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByVal lpMultiByteStr As String, ByVal cchMultiByte As Long, ByVal lpDefaultChar As Long, ByVal lpUsedDefaultChar As Long) As Long
Public Function AToUTF8(ByVal wText As String) As String
Dim vNeeded As Long
Dim vSize As Long
vSize = Len(wText)
vNeeded = WideCharToMultiByte(CP_UTF8, 0, StrPtr(wText), vSize, "", 0, 0, 0)
AToUTF8 = String(vNeeded, 0)
WideCharToMultiByte CP_UTF8, 0, StrPtr(wText), vSize, AToUTF8, vNeeded, 0, 0
End Function
Mais "a" me retourne une chaine vide.
Je dois certainement me planter