UTF8

UTF8[_locale][_n]

A UTF-8 encoded unicode character string of n characters, space-padded just as STRING is. If _n is omitted, the string is variable length to the size needed to contain the result of the cast or passed parameter. The optional locale specifies a valid unicode locale code, as specified in ISO standards 639 and 3166 (not needed if LOCALE is specified on the RECORD structure containing the field definition).

Type casting UTF8 to UNICODE, VARUNICODE, STRING, or DATA is allowed, while casting to any other type will first implicitly cast to STRING and then cast to the target value type.

The upper size limit for any UTF8 value is 4GB.

Example:

UTF8 FirstName := U8'Noël';                 // utf-8-encoded string
UTF8_de MyUnicodeString := U8'abcd\353';    // becomes 'abcdë' with a German locale
UTF8_4 FirstName4 := U8'Noël';              // 4-character utf-8-encoded string
UTF8_de_5 MyUnicodeString_de5 := U8'abcd\353'; // becomes 'abcdë' with a German locale

OUTPUT(FirstName);
OUTPUT(MyUnicodeString);
OUTPUT(FirstName4);
OUTPUT(MyUnicodeString_de5);