System.SysUtils.TEncoding.GetBufferEncoding

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

class function GetBufferEncoding(const Buffer: TBytes; var AEncoding: TEncoding): Integer; overload; static;
class function GetBufferEncoding(const Buffer: TBytes; var AEncoding: TEncoding;
ADefaultEncoding: TEncoding): Integer; overload; static;

C++

static int __fastcall GetBufferEncoding(const System::DynamicArray<System::Byte> Buffer, TEncoding* &AEncoding)/* overload */;
static int __fastcall GetBufferEncoding(const System::DynamicArray<System::Byte> Buffer, TEncoding* &AEncoding, TEncoding* ADefaultEncoding)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.SysUtils.pas
System.SysUtils.hpp
System.SysUtils TEncoding

Description

Determines the encoding for a given buffer.

GetBufferEncoding examines the Buffer parameter and determines its encoding by looking for known byte order marks (BOM). If the buffer doesn't contain a byte order mark for one of the standard encodings, the Default standard encoding is returned.

Buffer refers to a TBytes instance that will be examined.

AEncoding refers to an instance of TEncoding that will be filled out with the encoding type of the buffer.

Note: The AEncoding parameter should have the value NIL, otherwise its value is used to detect the encoding.

ADefaultEncoding referes to the fallback or default encoding. If you provide an encoding for this parameter in your call to GetBufferEncoding, your encoding will be used as the default encoding. If you do not use ADefaultEncoding, Default will be used.

Return Value of GetBufferEncoding is the length of the preamble in the Buffer of bytes.

See Also