UTF8

UTF8(x) returns a CHAR value that is the UTF-8 equivalent of x.

Read syntax diagramSkip visual syntax diagram
>>-UTF8(x-+----+-)---------------------------------------------><
          '-,c-'     

x
An expression that must have one of these types: FIXED, FLOAT, PICTURE, BIT, CHAR, or WIDECHAR.
c
A restricted expression that specifies the code page of the source. It is ignored if x has WIDECHAR type.

The code page must have a computational type and is converted to type FIXED BINARY (31,0). The code page must specify a valid, supported code page.

If x has the type other than WIDECHAR, the CODEPAGE option specifies the value for the code page of x when it is converted to UTF-8.

If x has the WIDECHAR type, it is converted to UTF-8 under the assumption that x holds UTF-16.

You can use UTF8(x) in restricted expressions. Therefore, you can use UTF8(x) to create UTF-8 literals.

Notes:





Published: 23 December 2018