Platoo VCL Web Components HelpTHTTPCharEncDec

Contents - Methods

Various HTTP <-> string encoders/decoders


Description
URL-encoded string <-> ANSI string

HTTP encoded string <-> ANSI string

Local TDateTime -> GMT TDateTime

TDateTime -> HTTP datetime string

Accessible from global variable HTTPCharEncDec


THTTPCharEncDec - Methods

Contents - THTTPCharEncDec

~THTTPCharEncDec
Destructor

C++ declaration
__fastcall virtual ~THTTPCharEncDec(void)

Description
Normally you do not need to destroy THTTPCharEncDec objects, use HTTPCharEncDec global object, that is created at programme startup and destroyed at shutdown.

DecodeHTMLToAnsi
HTML encoded text -> ANSI string

Delphi declaration
function DecodeHTMLToAnsi(const Source: String; bCheckEntityRefs: Boolean): String;
C++ declaration
System::AnsiString __fastcall DecodeHTMLToAnsi(const System::AnsiString Source, bool bCheckEntityRefs)

Description
Supports decimal and hexadecimal character references and, additionally, character entity references, when bCheckEntityRefs is set to TRUE.

DecodeURLToAnsi
URL-encoded text -> ANSI string

Delphi declaration
function DecodeURLToAnsi(const Source: String): String;
C++ declaration
System::AnsiString __fastcall DecodeURLToAnsi(const System::AnsiString Source)

Description
Character '+' -> ' '.

Sequense '%AB' -> HexToChar(AB).

EncodeAnsiTextToHTML
Text to HTML encoding

Delphi declaration
function EncodeAnsiTextToHTML(const Source: String; bUseEntityRefs: Boolean; iStartEntitiesFrom: Integer): String;
C++ declaration
System::AnsiString __fastcall EncodeAnsiTextToHTML(const System::AnsiString Source, bool bUseEntityRefs, int iStartEntitiesFrom)

Description
If bUseEntityRefs is TRUE, character entity references are used,

otherwise decimal references are used.

Characters with index less than iStartEntitiesFrom are not encoded.

EncodeAnsiToHTML
ANSI string -> HTML encoding, encodes all characters

Delphi declaration
function EncodeAnsiToHTML(const Source: String; bUseEntityRefs: Boolean): String;
C++ declaration
System::AnsiString __fastcall EncodeAnsiToHTML(const System::AnsiString Source, bool bUseEntityRefs)

Description
If bUseEntityRefs is TRUE, character entity references are used,

otherwise decimal references are used.

EncodeAnsiToURL
ANSI string -> URL-encoded

Delphi declaration
function EncodeAnsiToURL(const Source: String): String;
C++ declaration
System::AnsiString __fastcall EncodeAnsiToURL(const System::AnsiString Source)

Description
Characters less 128 are not encoded (except '%' and ' '),

others encoded as '%'+<Character in hex>.

EncodeHTMLPage
HTML page encoding, encodes only characters >= 128

Delphi declaration
function EncodeHTMLPage(const Source: String; bUseEntityRefs: Boolean): String;
C++ declaration
System::AnsiString __fastcall EncodeHTMLPage(const System::AnsiString Source, bool bUseEntityRefs)

Description
Usable when source text contains HTML symbols ('<','>',etc.) that must not be encoded.

When bUseEntityRefs is TRUE, character entity references are used,

otherwise decimal references are used.

EncodeHTTPDate
TDateTime -> HTTP date

Delphi declaration
function EncodeHTTPDate(tdDateTime: TDateTime): String;
C++ declaration
System::AnsiString __fastcall EncodeHTTPDate(System::TDateTime tdDateTime)

Description
It is expected that tdDateTime is already set as GMT.

Example: 'Sun, 12 May 2001 10:25:03 GMT'

GenerateAnsiCharTable
Test

Delphi declaration
function GenerateAnsiCharTable(iBorderWidth: Integer): String;
C++ declaration
System::AnsiString __fastcall GenerateAnsiCharTable(int iBorderWidth)

Description
Generates encoded table of characters 32...255 as HTML text.

GetHTTPStatusCodeString
Returns HTTP status string from statuscode

Delphi declaration
function GetHTTPStatusCodeString(StatusCode: Integer): AnsiString;
C++ declaration
System::AnsiString __fastcall GetHTTPStatusCodeString(int StatusCode)

Description
Example: 200 returns 'OK', etc.

HTMLCharRefToChar
Internal character reference to char decoder

Delphi declaration
function HTMLCharRefToChar(const Source: String): String;
C++ declaration
System::AnsiString __fastcall HTMLCharRefToChar(const System::AnsiString Source)

LocalDateTimeToGMT
Local date-time to GMT

Delphi declaration
function LocalDateTimeToGMT(tdDateTime: TDateTime): TDateTime;
C++ declaration
System::TDateTime __fastcall LocalDateTimeToGMT(System::TDateTime tdDateTime)

Description
Uses computer timezone information.

THTTPCharEncDec
Constructor

C++ declaration
__fastcall THTTPCharEncDec(void)

Description
Normally you do not need to create THTTPCharEncDec objects, use HTTPCharEncDec global object, that is created at programme startup.