UTF16 Summary Provides UTF-16 encoding and decoding. Description This class provides UTF-16 encoding and decoding methods. UTF-16 is a variable-width character encoding defined by the Unicode Standard. Each character is represented using one to two 16-bit code units. While this class supports both little endian and big endian decoding of UTF-16 encoded byte sequences, the encoding method will encode using little endian encoding, and the encoded result will always be prefixed with the byte order mark (BOM) 0xFF + 0xFE to indicate little endian encoding. Examples Basic Usage 1234567891011import System;import System.Encoding; byte[] encoded = UTF16.encode("�"); string toHex = "";foreach(byte b in encoded) { toHex += "\\x" + b.toHex().toUpperCase();} Console.log(toHex); // "\xFF\xFE\xAC\x20" Methods decodeDecodes UTF-16 encoded text. encodeEncodes a string of text using UTF-16 encoding. Share HTML | BBCode | Direct Link