UTF8ToUCS2BE function
Converts a UTF-8-encoded value to UCS 2-byte Big Endian encoding.
Declaration
function UTF8ToUCS2BE(const s: string): stringDescription
UTF8ToUCS2BE converts the string value in s from its multi-byte variable length UTF-8 encoding to the fixed length 16-bit character set used in the UCS2 BE (Big Endian) encoding. UTF8ToUCS2BE iterates over each of the UTF-8 codepoints in s, and calls NtoBE to convert the Unicode character value to the Most Significant byte order used in the encoding. Unicode characters with a value $FFFF or greater are ignored in the conversion.
No actions are performed in the routine when s contains an empty string (''), and the return value is set to an empty string as well.
UTF8ToUCS2BE does not include a byte order mark (BOM) in the UCS2-encoded output.
An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.
