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

SingleByteToUTF8

Converts a string with single-byte values to UTF-8 using a character translation array.

Declaration

Source position: lconvencoding.pas line 164

function SingleByteToUTF8(

  const s: string;

  const Table: TCharToUTF8Table

):string;

Arguments

s

  

String with the single-byte values converted in the routine.

Table

  

Table with Character to PChar mappings for the converted value.

Function result

String with the UTF-8-encoded value, or an empty string.

Description

s is the string, in its single-byte encoding, with the character values converted in the routine.

Table is a TCharToUTF8Table type and contains an array with the multi-byte values for each of the character using the UTF-8 encoding. The array has 256 elements representing #0 and each of the decimal values in the single byte character set, and may contain 1-4 byte values as needed for the UTF-8 encoding.

SingleByteToUTF8 iterates over the character values in s, and converts each single-byte character to the multi-byte value at the corresponding ordinal position in Table. If s is an empty string (''), the return value is also an empty string.

The return value is cast to a RawByteString type, and its code page is set to CP_UTF8 (65001).

See also

TCharToUTF8Table

  

Alias for the TCharToUTF8Table type in CodepagesCommon.pas.

ArrayISO_8859_1ToUTF8

  

Provides a mapping for ISO-8859-1 characters to UTF-8 codepoints.

ArrayISO_8859_2ToUTF8

  

Provides a mapping for ISO-8859-2 characters to UTF-8 codepoints.

ArrayISO_8859_14ToUTF8

  

Provides a mapping for ISO-8859-15 characters to UTF-8 codepoints.

ArrayISO_8859_15ToUTF8

  

Provides a mapping for ISO-8859-15 characters to UTF-8 codepoints.

ArrayCP1250ToUTF8

  

Provides a mapping for Code Page 1250 characters to UTF-8 codepoints.

ArrayCP1251ToUTF8

  

Provides a mapping for Code Page 1251 characters to UTF-8 codepoints.

ArrayCP1252ToUTF8

  

Provides a mapping for Code Page 1252 characters to UTF-8 codepoints.

ArrayCP1253ToUTF8

  

Provides a mapping for Code Page 1253 characters to UTF-8 codepoints.

ArrayCP1254ToUTF8

  

Provides a mapping for Code Page 1254 characters to UTF-8 codepoints.

ArrayCP1255ToUTF8

  

Provides a mapping for Code Page 1255 characters to UTF-8 codepoints.

ArrayCP1255ToUTF8

  

Provides a mapping for Code Page 1255 characters to UTF-8 codepoints.

ArrayCP1257ToUTF8

  

Provides a mapping for Code Page 1257 characters to UTF-8 codepoints.

ArrayCP437ToUTF8

  

Provides a mapping for Code Page 437 characters to UTF-8 codepoints.

ArrayCP850ToUTF8

  

Provides a mapping for Code Page 850 characters to UTF-8 codepoints.

ArrayCP866ToUTF8

  

Provides a mapping for Code Page 866 characters to UTF-8 codepoints.

ArrayKOI8RToUTF8

  

Provides a mapping for KOI8-R characters to UTF-8 codepoints.

ArrayKOI8UToUTF8

  

Provides a mapping for KOI8-U characters to UTF-8 codepoints.

ArrayMacintoshToUTF8

  

Provides mappings for Apple macOS encoding to UTF-8 encoding.


Version 3.2 Generated 2024-02-25 Home