Internet Direct (Indy)
Home
PreviousUpNext
TIdEncoderQuotedPrintable.Encode Method

Applies the Quoted-Printable encoding scheme to values in a stream.

Pascal
function Encode(
    ASrcStream: TIdStream; 
    const ABytes: integer = MaxInt
): string; override;
Parameters 
Description 
ASrcStream 
Stream contain byte values to be encoded.
 
ABytes 
Number of bytes from the stream to be encoded. Default value is MaxInt. 

string - Values after applying the Quoted-Printable encoding.

Encode is an overridden String function used to apply the Quoted-Printable encoding scheme to values in a stream. The Quoted-Printable encoding scheme is described in the Internet Standards document: 

RFC 2045, Multipurpose Internet Mail Extensions (MIME), Part One: Format of Internet Message Bodies, Section 6.7 Quoted-Printable Content Transfer Encoding

ASrcStream is the stream containing the un-encoded values to be used in the encoding operation. When ASrcStream has a size of 0, no operation is performed by the Encode method. 

ABytes indicates the number of bytes to read from the stream for use in the method. The default value is MaxInt, and indicates that all remaining byte values in the stream will receive the Quoted-Printable encoding. Please note that any value in ABytes is ignored in the current implementation. 

Encode uses values starting at the current position in the stream; no stream positioning is performed prior to reading the un-encoded values from ASrcStream. 

Encode reads data from the stream indicated by ASrcStream, and applies Quoted-Printable encoding for any characters not regarded as "Safe Characters" in the encoding scheme. The quoted-printable encoding algorithm does not perform any conversion for the following characters in the ranges 33-60 Decimal (inclusive) or 62-126 Decimal (inclusive). 

The Encode method encodes any '.' (Period)(Decimal 46) character that appears at the beginning of an encoded line to it's quoted-printable hexidecimal representation ("=2E"). 

Whitespace characters (Space and TAB) followed by an end-of-line character (CR or LF) are converted to their quoted-printable hexidecimal representations. 

The Encode method applies line folding for individual lines of data that exceed 72 encoded characters. When the maximum line length is reached, a line-end marker ("=" Decimal 61) is inserted in the output and encoding resumes on the following line. 

The Equal Sign ("=" Decimal 61) is reserved as the quoted-printable prefix marker and line-end marker. Any occurrences of this character found the AStream will be converted to the quoted-printable hexidecimal representation ("=3D"). 

Please note that Encode does not reset the position of the stream in ASrcStream after the encoding operation. 

The return value for the method contains the bytes read from ASrcStream and encoded using the Quoted-Printable encoding scheme. 

Use the Decode method in TIdDecoderQuotedPrintable to convert values to their un-encoded form.

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.