You are here: Functions > UNICODE()

UNICODE()

UNICODE() converts an ASCII value to UTF-16.

Use UNICODE() when you want to ensure that expressions, computed fields or variables are assigned a UTF-16 value when working with ASCII data or functions which default to ASCII values.

Function Format

UNICODE(C)

The UNICODE() function converts all ASCII characters to UTF-16 characters.

Examples

The following example demonstrates initializing a variable in a procedure to ensure that the variable is deemed to be storing UNICODE values, not ASCII values.

ASSIGN V_INVOICE_NO=UNICODE(BLANKS(8))

If the variable is initially given a value BLANKS(8) but is not updated later within the procedure using a UNICODE field value, then the value outputted (for example using the Extract command) will be ASCII not UNICODE. By using the UNICODE() function, the variable result will always be outputted as UNICODE (UTF-16), whether the variable is subsequently assigned a UNICODE value or not. This ensures consistency of the outputted results.