Hi All
This function in VC++ (MultiByteToWideChar )
i WANT TO USE THIS FUNCTION IN VB TO CONVERT uNICODE
tO STRING bUT UTF-8
aNY hELP
tHANKS
Efrat
[email protected]
Printable View
Hi All
This function in VC++ (MultiByteToWideChar )
i WANT TO USE THIS FUNCTION IN VB TO CONVERT uNICODE
tO STRING bUT UTF-8
aNY hELP
tHANKS
Efrat
[email protected]
check : http://msdn.microsoft.com/library/ps...icode_17si.htm
Here's the declarations
Here's a typical call:Code: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
Private Declare Function WideCharToMultiByte Lib "kernel32" _
(ByVal CodePage As Long, ByVal dwFlags As Long, _
ByVal lpWideCharStr As String, ByVal cchWideChar As Long, _
ByVal lpMultiByteStr As String, ByVal cchMultiByte As Long, _
ByVal _lpDefaultChar As String, ByVal lpUsedDefaultChar As Long) As Long
Const CP_UTF8 = 65001
Const CP_OEMCP = 1
Private Const CP_ACP = 0 ' default to ANSI code page
hope this helps ;)Code:ret = MultiByteToWideChar(CP_UTF8, 0, strMByte, Len(strMByte), strWide, Len(strWide))
hI I TRY WITH THIS CODE BUT ITS LOOK
THAT I GOT DIFFERENT SIZE OF THE STRING
I'm not sure I understand your question correctly.
Actually I'm not sure the MultiByteToWideChar function is what you really need.
VB String type is UNICODE, supposedly UTF-16 (BSTR), based - 2 bytes per char.
Multibyte (MBCS) strings can contain both 1 or 2 bytes.
Can you give me an example of what you want to do exactly?
I need to convert string in unicode to string in UTF-8 format
For example : tomithebest is string i need to convert it to utf-8
thanks
I don't think this API function does what you want.
They basically convert ANSI strings to Unicode and Unicode to ANSI. They don't convert Unicode UTF-16 to Unicode UTF-8.
You should check : http://czyborra.com/utf/#UTF-8 for more
detail and some examples in C to see how to do conversions
between the different formats.
But you should verify if the StrConv function doesn't do what you want.
Hope this helps.
efrat you were able to convert to utf-8?