RAD Studio VCL Reference
TEncoding.GetBufferEncoding Method

Determines the encoding for a given buffer.

class function GetBufferEncoding(const Buffer: TBytes; var AEncoding: TEncoding): Integer; static;
static __fastcall int GetBufferEncoding(const TBytes Buffer, TEncoding AEncoding);

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.  

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

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


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!