TCharacterEncoding

Abstract base class for mappings between Unicode characters and their physical byte representations.

Inheritance

LevelAncestorDescription
1TObjectUltimate ancestor in a class hierarchy
2TCharacterEncoding

Source

Character.Encoding.pas (28)

Description

Unicode characters (code points) can be physically encoded as a sequence of bytes using different schemes. Descendants of this class implement these schemes by providing the proper implementations for Encode and Decode, both of which accept a stream of bytes. Schemes can encode code points using either a fixed or variable byte length sequence for each code point.

A TCharacterEncoding is allowed to support only a subset of all valid Unicode code points. However, for optimal interoperability one is encouraged to use encodings that support the entire Unicode character set as much as possible. Utf8 makes a good default.

Fields

ScopeVisibilityTypeNameDescription
InstanceprivateTStringFIdentifier
TypeprivateTBooleanInitialized
TypepublicTCharacterEncodingIso8859_1
TypepublicTCharacterEncodingUtf8
TypepublicTCharacterEncodingUtf16LittleEndian
TypepublicTCharacterEncodingUtf16BigEndian
TypepublicTCharacterEncodingUsAscii
TypepublicTCharacterEncodingWindows1252
TypepublicTCharacterEncodingIa5

Methods

ScopeVisibilityResultNameDescription
InstancepublicCreate(Identifier: TString)
InstancepublicTBooleanSupports(CodePoint: TCharacterCodePoint)Returns whether this encoding supports a specific code point. The code point is assumed to be valid and is not checked.
InstancepublicEncode(Stream: TOutputStream; CodePoint: TCharacterCodePoint)
InstancepublicTCharacterCodePointDecode(Stream: TInputStream)
InstancepublicTBooleanIsConcatenatable() Indicates whether the concatenation of the byte representations of character strings using this encoding equals the byte representation of the concatenation of those character strings.
InstancepublicTBooleanEqual(Encoding: TCharacterEncoding)
TypeprivateInitialize()
TypepublicAssureInitialized()
TypepublicFinalize()
TypepublicTCharacterEncodingFromText(Identifier: TString)