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

UTF8ToUCS2BE

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

Declaration

Source position: lconvencoding.pas line 206

function UTF8ToUCS2BE(

  const s: string

):string;

Arguments

s

  

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

Function result

String value after conversion to UCS2 BE encoding.

Description

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.


Version 3.2 Generated 2024-02-25 Home