Sign in Join
FPDoc Onlineexperiment

UTF8ToDoubleByteString function

In unit LazUTF8

Converts UTF-8 values to their DBCS equivalent.

Declaration

pascal
function UTF8ToDoubleByteString(const s: string): string

Arguments

s

UTF-8-encoded values to convert in the function.

Function result

DBCS values for the specified codepoints.

Description

UTF8ToDoubleByteString is a String function used to convert UTF-8-encoded values to the representation used in Double Byte Character Sets (DBCS).

UTF8ToDoubleByteString calls UTF8Length to get the number of codepoints (or characters) in s, and calls UTF8ToDoubleByte to perform the conversion. Each codepoint is converted to Unicode by calling UTF8CodepointToUnicode.

The return value is a String type with the byte values from the conversion, or an empty string ('') when s does not contain a valid UTF-8-encoded string.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.