Parameter | Description |
---|---|
pMultiCharBuffer | The address of a UTF-8 string |
eCharType | The type of string encoding, which may be OEM (CP_OEMCP), ANSI (CP_ACP) or UTF-8 (CP_UTF8) |
The buffer address of the converted string
Function Utf8ToBuffer Pointer pMultiCharBuffer Integer eCharType Returns Pointer
Call: | Get Utf8ToBuffer pMultiCharBuffer eCharType to PointerVariable |
Utf8ToBuffer creates an OEM or ANSI string in a memory buffer from a UTF-8 memory buffer.
The length of the returned string may be obtained using CStringLength().
You are responsible for eventually disposing of the newly created memory buffer.
Use Windows.pkg Use cCharTranslate.pkg Object oCharTranslate is a cCharTranslate End_Object // test Utf8FromBuffer and Utf8ToBuffer Procedure TestUTF8Buffer Address aVar aUTF8Buffer aVar2 Integer iVoid String sVar sVar2 Move "Test String-Ññóí" to sVar Move (AddressOf(sVar)) to aVar // Move OEM to UTF8 buffer Get Utf8FromBuffer of oCharTranslate aVar CP_OEMCP to aUTF8Buffer // Note length of UTF-8 buffer is CStringLength(aUTF8Buffer) // Move UTF8 Buffer to OEM String Get Utf8ToBuffer of oCharTranslate aUTF8Buffer CP_OEMCP to aVar2 // Note length of OEM buffer is CStringLength(aVar2) Move aVar2 to sVar2 If (sVar<>sVar2) Begin Send Info_Box "Test Failed" End Move (Free(aUTF8Buffer)) to iVoid Move (Free(aVar2)) to iVoid End_Procedure Send TestUTF8BufferSee Also