Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The QMailQuotedPrintableCodec class encodes or decodes between 8-bit data and 7-bit ASCII, using the 'quoted printable' character mapping scheme. More...
#include <QMailQuotedPrintableCodec>
This class is under development and is subject to change.
Inherits QMailCodec.
The QMailQuotedPrintableCodec class encodes or decodes between 8-bit data and 7-bit ASCII, using the 'quoted printable' character mapping scheme.
The 'quoted printable' character mapping scheme maps arbitrary 8-bit values into 7-bit ASCII characters, by replacing values that cannot be directly represented with an escape sequence. The mapping scheme used is defined in RFC 2045 (Multipurpose Internet Mail Extensions Part One). A minor variation on the scheme is defined as the '"Q" encoding' for 'encoded words' in RFC 2047 (Multipurpose Internet Mail Extensions Part Three).
The 'quoted printable' scheme encodes only those incoming octet values that cannot be directly represented in ASCII, by replacing the input octet with a three-character sequence that encodes the numeric value of the original octet. Therefore, the ratio of input length to output length for any input data sequence depends on the percentage of the input that corresponds to ASCII values, with ASCII-like encodings producing only small increases. With an input data encoding such as Latin-1 (ISO-8859-1), the output maintains a reasonable degree of human-readability.
An instance of QMailQuotedPrintableCodec contains state information about the encoding or decoding operation it performs, so an instance should be used for a single coding operation only:
QByteArray asciiData = acquireInput(); // We know the data is text in Latin-1 encoding, so decode the data from // quoted printable ASCII encoding, and then decode from Latin-1 to unicode QMailQuotedPrintableCodec decoder(QMailQuotedPrintableCodec::Text, QMailQuotedPrintableCodec::Rfc2045); QString textData = decoder.decode(asciiData, "ISO-8859-1");
See also QMailCodec.
This enumerated type is used to specify which RFC the coding operation should conform to.
Constant | Value | Description |
---|---|---|
QMailQuotedPrintableCodec::Rfc2045 | 0 | The coding should be performed according to the requirements of RFC 2045. |
QMailQuotedPrintableCodec::Rfc2047 | 1 | The coding should be performed according to the requirements of RFC 2047's '"Q" encoding'. |
This enumerated type is used to specify whether content is textual data or binary data.
Constant | Value | Description |
---|---|---|
QMailQuotedPrintableCodec::Text | 0 | The data is textual data; newline sequences within the data will be converted during coding. |
QMailQuotedPrintableCodec::Binary | 1 | The data is not textual, and does not contain newline sequences. |
Constructs a codec object for coding data of type content, using the mapping scheme specified by the requirements of conformance.
If content is QMailQuotedPrintableCodec::Text, then newline sequences will be converted between the local representation (for example, 0x0A on Unix) and the transmission standard representation (0x0D 0x0A). Otherwise, the data will be coded without modification.
If conformance is QMailQuotedPrintableCodec::Rfc2047, then coding will use the mapping scheme of the RFC 2047 '"Q" encoding'; otherwise the scheme defined in RFC 2045 will be used.
The maximum number of encoded output characters per line can be specified as maximumLineLength. If not specified, or specified to a non-positive value, a default value will be used.
Copyright © 2009 Trolltech | Trademarks | Qt Extended 4.4.3 |