Sign in Join
FPDoc Onlineexperiment

TEncoding class

In unit sysutils

Encoding support.

Declaration

pascal
TEncoding = class

Descends from it: TMBCSEncoding TUnicodeEncoding

Description

TEncoding is a mostly abstract class that contains various methods to deal with different encodings in single- and double-byte strings. In practice, one instance of a descendent of this class for each needed encoding can be instantiated and used. The class contains several class methods and properties to create such instances, and has several often-used instances available as class properties, in particular the default encoding.

When using encodings (and in particular Default or ANSI), if the DefaultSystemCodePage changes, you should call FreeEncodings to regenerate the encodings.

See also

Properties

CodePagepublicCodepage for this encoding.
EncodingNamepublicName of this encoding.
IsSingleBytepublicIs the encoding a single-byte encoding or not ?
ANSIpublicAnsi encoding instance.
ASCIIpublicASCII encoding instance.
BigEndianUnicodepublicBig-endian Unicode (UTF16BE) encoding instance.
DefaultpublicDefault codepage.
SystemEncodingpublicSystem encoding.
UnicodepublicUTF16 encoding instance.
UTF7publicUTF7 encoding instance.
UTF8publicUTF8 encoding instance.

Methods

GetByteCountstrict prote
GetBytesstrict prote
GetCharCountstrict prote
GetCharsstrict prote
GetAnsiBytesstrict prote
GetAnsiStringstrict prote
GetCodePagestrict prote
GetEncodingNamestrict prote
ClonepublicClone a TEncoding instance.
ConvertpublicConvert an array of bytes from one encoding to another.
IsStandardEncodingpublicCheck if the encoding is one of the standard encodings.
GetBufferEncodingpublicAttempt to guess the encoding of a buffer.
GetEncodingpublicGet an encoding instance for a given codepage.
GetMaxByteCountpublicReturns the maximum number of bytes needed to represent a string.
GetMaxCharCountpublicReturn the maximum number of characters that can be represented in a number of bytes.
GetPreamblepublicReturn the BOM Marker used by the encoding.
GetStringpublicReturn a string based on an array of bytes.

Fields

FIsSingleBytestrict prote
FMaxCharSizestrict prote

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