TCharacterEncoding
Abstract base class for mappings between Unicode characters and their physical byte representations.
Inheritance
Level | Ancestor | Description |
---|---|---|
1 | TObject | Ultimate ancestor in a class hierarchy |
2 | TCharacterEncoding |
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
Scope | Visibility | Type | Name | Description |
---|---|---|---|---|
Instance | private | TString | FIdentifier | |
Type | private | TBoolean | Initialized | |
Type | public | TCharacterEncoding | Iso8859_1 | |
Type | public | TCharacterEncoding | Utf8 | |
Type | public | TCharacterEncoding | Utf16LittleEndian | |
Type | public | TCharacterEncoding | Utf16BigEndian | |
Type | public | TCharacterEncoding | UsAscii | |
Type | public | TCharacterEncoding | Windows1252 | |
Type | public | TCharacterEncoding | Ia5 |
Methods
Scope | Visibility | Result | Name | Description |
---|---|---|---|---|
Instance | public | Create(Identifier: TString) | ||
Instance | public | TBoolean | Supports(CodePoint: TCharacterCodePoint) | Returns whether this encoding supports a specific code point. The code point is assumed to be valid and is not checked. |
Instance | public | Encode(Stream: TOutputStream; CodePoint: TCharacterCodePoint) | ||
Instance | public | TCharacterCodePoint | Decode(Stream: TInputStream) | |
Instance | public | TBoolean | IsConcatenatable() | 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. |
Instance | public | TBoolean | Equal(Encoding: TCharacterEncoding) | |
Type | private | Initialize() | ||
Type | public | AssureInitialized() | ||
Type | public | Finalize() | ||
Type | public | TCharacterEncoding | FromText(Identifier: TString) |