UTF8()
Syntax
*Buffer = UTF8(String$)Description
Creates a buffer with an UTF8 representation of the string. When no more needed, the buffer needs to be freed with FreeMemory().
Parameters
String$ The string to convert.
Return value
The UTF8 representation of the string.
Remarks
This function is mainly useful when interacting with third-party libraries which requiers UTF8 as input. Pseudotype 'p-utf8' can also be used to automated the converting process when importing external functions.
The buffer includes a null-terminated character.
Example
*UTF8 = UTF8("Hélé")
ShowMemoryViewer(*UTF8, 6)
Debug PeekS(*Ascii, -1, #PB_Ascii) ; Displays "Hélé"
Example
Macro Unicode(Mem, Type = #PB_Ascii)
PeekS(Mem, -1, Type)
EndMacro
*Mem1 = Ascii("Test - éàîöÊÜ")
*Mem2 = UTF8("Test - éàîöÊÜ")
Text.s = Unicode(*Mem1)
Debug Text
Text2.s = Unicode(*Mem2, #PB_UTF8)
Debug Text2
See Also
Ascii()
Supported OS
All