Returns a character string that is the UTF-8 equivalent of its argument.
UTF8(x)
x is an expression that can be converted to a character string. If x is not WIDECHAR type, it is converted to character string before the conversion to its UTF-8 equivalent.
The UTF8 function returns a CHARACTER string that is the UTF-8 equivalent of its argument x. The length of the returned string may be up to two times the length of x for CHARACTER and up to three times for WIDECHAR. If this length exceeds the maximum allowed for the CHARACTER type or the WIDRECHAR input string contains invalid UTF16 characters, the ERROR condition is raised.
dcl u8 char(12) var; u8 = utf8('Hello World.'); put skip list('From ASCII: ', hex(u8)); put skip list(utf8tochar(u8));
produces the result:
From ASCII: 000C48656C6C6F20576F726C642E Hello World.
None.