Sign in Join
FPDoc Onlineexperiment

UTF8ToCP874 function

In unit LConvEncoding

Converts a string from UTF-8 encoding to Code Page 874.

Declaration

pascal
function UTF8ToCP874(const s: string; SetTargetCodePage: Boolean=False)
: RawByteString

Arguments

s

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

SetTargetCodePageTrue if the target code page is set in the return value, False if a code page is not used.

Function result

String value after conversion to Code Page 874.

Description

UTF8ToCP874 is a RawByteString function used to convert a UTF-8-encoded string to the Code Page 874 (Thai) encoding.

UTF8ToCP874 calls the UTF8ToSingleByte routine using UnicodeToCP874 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP874 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 874 in the return value.

UTF8ToCP874 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.

See also

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