[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'sysutils' (#rtl)


[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Encoding support


Source position: sysencodingh.inc line 21

type TEncoding = class


  function Clone; virtual;


Clone a TEncoding instance

  class function Convert();


Convert an array of bytes from one encoding to another

  class function IsStandardEncoding();


Check if the encoding is one of the standard encodings

  class function GetBufferEncoding();


Attempt to guess the encoding of a buffer

  class function GetEncoding();


Get an encoding instance for a given codepage.

  function GetMaxByteCount(); virtual; abstract;


Returns the maximum number of bytes needed to represent a string

  function GetMaxCharCount(); virtual; abstract;


Return the maximum number of characters that can be represented in a number of bytes

  function GetPreamble; virtual; abstract;


Return the BOM Marker used by the encoding

  function GetString();


Return a string based on an array of bytes

  property CodePage: Cardinal; [r]


Codepage for this encoding

  property EncodingName: UnicodeString; [r]


Name of this encoding

  property IsSingleByte: Boolean; [r]


Is the encoding a single-byte encoding or not ?

  property ANSI: TEncoding; [r]


Ansi encoding instance

  property ASCII: TEncoding; [r]


ASCII encoding instance

  property BigEndianUnicode: TEncoding; [r]


Big-endian Unicode (UTF16BE) encoding instance

  property Default: TEncoding; [r]


Default codepage

  property SystemEncoding: TEncoding; [r]

  property Unicode: TEncoding; [r]


UTF16 encoding instance

  property UTF7: TEncoding; [r]


UTF7 encoding instance

  property UTF8: TEncoding; [r]


UTF8 encoding instance





Encoding support




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 TEncoding.Default or TEncoding.ANSI), if the DefaultSystemCodePage changes, you should call TEncoding.FreeEncodings to regenerate the encodings.

See also



Ansi encoding instance



ASCII encoding instance



Default codepage



Big-endian Unicode (UTF16BE) encoding instance



UTF16 encoding instance



UTF7 encoding instance



UTF8 encoding instance

Documentation generated on: May 14 2021