EncodeStringFromVariant

Text, Miscellaneous functions

Description

This function is used to encode a string in UTF-16LE format from an array of numbers stored as a Variant type.

Syntax

Parameters

NumberList

A variant array of numbers. The numbers in the array can be stored in any ordinal variant type (signed or unsigned integers from 8 to 32 bits).

Encoding

A string that defines how numbers in the array should be mapped to character codes:

"Unicode" = The numbers represent Unicode code points with values ranging from 0x0000 to 0x10FFFD.

"UTF-8" = The numbers represent the bytes of Unicode code points encoded using the variable-length UTF-8 encoding scheme with values ranging from 0 to 244.

"UTF-16" = The numbers represent the 16-bit values of Unicode code points encoded using the variable-length UTF-16 encoding scheme with values ranging from 0 to 65533. Unicode values from U+010000 to U+10FFFD are represented by a surrogate pair consisting of a sequence of two numbers.

"UTF-16LE" = The numbers represent the bytes of the UTF-16 encoding scheme stored in little-endian format with values ranging from 0 to 255. "UTF-16BE" = The numbers represent the bytes of the UTF-16 encoding scheme stored in big-endian format with values ranging from 0 to 255. "CP932" = The numbers represent either individual bytes or a combination of 8-bit and 16-bit values from Microsoft code page 932 (an extension of Shift JIS encoding). Double-byte values can be presented as a 16-bit number or as two 8-bit numbers.

For encodings where numbers represent bytes this function will cast signed 8-bit values to unsigned 8-bit values.

UnmatchedAction

Specifies how to handle numbers that are out of range or that map to invalid character codes:

0 = Unmatched characters are ignored

1 = Unmatched characters are replaced with the Unicode U+FFFD replacement character