Attempt to guess the encoding of a buffer.
Source position: sysencodingh.inc line 70
public class function TEncoding.GetBufferEncoding( |
const Buffer: TBytes; |
var AEncoding: TEncoding |
):Integer; overload; |
const Buffer: TBytes; |
var AEncoding: TEncoding; |
ADefaultEncoding: TEncoding |
):Integer; overload; |
GetBufferEncoding checks the BOM marker of an array of bytes Buffer, and returns the found encoding in AEncoding. Only the TEncoding.BigEndianUnicodeTEncoding.Unicode and TEncoding.UTF8 encodings will be tried.
If AEncoding is non-Nil on entry, it will be used to check the BOM marker with. No other encoding will be tried in that case.
If ADefaultEncoding is specified, it will be returned in case no match was found.
The function returns the number of bytes in the BOM Marker.
|
Big-endian Unicode (UTF16BE) encoding instance. |
|
|
UTF16 encoding instance. |
|
|
UTF8 encoding instance. |
|
|
Return the BOM Marker used by the encoding. |