System.NetEncoding.THTMLEncoding

From RAD Studio API Documentation
Jump to: navigation, search

System.NetEncoding.TNetEncodingSystem.TObjectTHTMLEncoding

Delphi

THTMLEncoding = class(TNetEncoding)

C++

class PASCALIMPLEMENTATION THTMLEncoding : public TNetEncoding

Properties

Type Visibility Source Unit Parent
class public
System.NetEncoding.pas
System.NetEncoding.hpp
System.NetEncoding System.NetEncoding

Description

Provides methods to encode and decode data in HTML format.

THTMLEncoding only encodes reserved HTML characters: "&<>. THTMLEncoding supports decoding any HTML numeric character reference, such as &amp;#169; or &amp;#254;, as well as the character entity references of reserved HTML characters: &amp;quot;, &amp;amp;, &amp;lt;, &amp;gt;.

Warning: Decoding character entity references of non-reserved characters, such as &amp;apos; or &amp;copy;, is not supported. The input data must not contain any other character entity references. Otherwise, the output data may be corrupted.

THTMLEncoding provides the following methods:

Encoding Decoding
Input Method Output Input Method Output

TBytes

EncodeBytesToString

String

DecodeStringToBytes

TBytes

TBytes

Encode

TBytes

Decode

TBytes

TStream

TStream

TStream

String

String

String

For example:

  • Encode('© "name & surname" <email>') returns '© &quot;name &amp; surname&quot; &lt;email&gt;'.
  • Decode('&#169; &quot;name &amp; surname&quot; &lt;email&gt;') returns '© "name & surname" <email>'.

See Also