ULENGTH8

ULENGTH8 returns a FIXED BIN(31) value, which is the length of a CHAR string needed if the UTF characters held in a string were converted to UTF-8.

Read syntax diagramSkip visual syntax diagramULENGTH8( x)
x
Expression. x must have CHARACTER or WIDECHAR type.

If x has CHARACTER type, then ULENGTH8 is the same as LENGTH, and the string will not be checked for valid UTF-8 data.

If x has WIDECHAR type, then the string must contain valid UTF-16 data, and ULENGTH8 will return the length of the CHAR string that would result if x were converted from UTF-16 to UTF-8. If the string does not contain valid UTF-16 data, the program is in error.

For example, if x equals the WIDECHAR string '004B_00E4_0073_0065'wx, then ULENGTH8(x) returns 5.