[Overview][Constants][Types][Procedures and functions][Variables][Index] Reference for unit 'LConvEncoding' (#lazutils)

UTF8ToUCS2LE

Converts a UTF-8-encoded value to UCS 2-byte Little Endian encoding.

Declaration

Source position: lconvencoding.pas line 205

function UTF8ToUCS2LE(

  const s: string

):string;

Arguments

s

  

UTF-8-encoded string value converted in the routine.

Function result

String value after conversion to UCS2 LE encoding.

Description

UTF8ToUCS2LE 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 LE (Little Endian) encoding. UTF8ToUCS2LE iterates over each of the UTF-8 codepoints in s, and calls NtoLE to convert the Unicode character value to the Least 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.

UTF8ToUCS2LE does not include a byte order mark (BOM) in the UCS2-encoded output.


Version 3.2 Generated 2024-02-25 Home