Various HTTP <-> string encoders/decoders
Description
URL-encoded string <-> ANSI stringHTTP encoded string <-> ANSI string
Local TDateTime -> GMT TDateTime
TDateTime -> HTTP datetime string
Accessible from global variable HTTPCharEncDec
~THTTPCharEncDec
DestructorDecodeHTMLToAnsiC++ 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.
HTML encoded text -> ANSI stringDecodeURLToAnsiDelphi 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.
URL-encoded text -> ANSI stringEncodeAnsiTextToHTMLDelphi declaration
function DecodeURLToAnsi(const Source: String): String;
C++ declaration
System::AnsiString __fastcall DecodeURLToAnsi(const System::AnsiString Source)
Description
Character '+' -> ' '.Sequense '%AB' -> HexToChar(AB).
Text to HTML encodingEncodeAnsiToHTMLDelphi 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.
ANSI string -> HTML encoding, encodes all charactersEncodeAnsiToURLDelphi 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.
ANSI string -> URL-encodedEncodeHTMLPageDelphi 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>.
HTML page encoding, encodes only characters >= 128EncodeHTTPDateDelphi 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.
TDateTime -> HTTP dateGenerateAnsiCharTableDelphi 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'
TestGetHTTPStatusCodeStringDelphi 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.
Returns HTTP status string from statuscodeHTMLCharRefToCharDelphi declaration
function GetHTTPStatusCodeString(StatusCode: Integer): AnsiString;
C++ declaration
System::AnsiString __fastcall GetHTTPStatusCodeString(int StatusCode)
Description
Example: 200 returns 'OK', etc.
Internal character reference to char decoderLocalDateTimeToGMTDelphi declaration
function HTMLCharRefToChar(const Source: String): String;
C++ declaration
System::AnsiString __fastcall HTMLCharRefToChar(const System::AnsiString Source)
Local date-time to GMTTHTTPCharEncDecDelphi declaration
function LocalDateTimeToGMT(tdDateTime: TDateTime): TDateTime;
C++ declaration
System::TDateTime __fastcall LocalDateTimeToGMT(System::TDateTime tdDateTime)
Description
Uses computer timezone information.
ConstructorC++ declaration
__fastcall THTTPCharEncDec(void)
Description
Normally you do not need to create THTTPCharEncDec objects, use HTTPCharEncDec global object, that is created at programme startup.