QP (Quote-printable) Encoding

Source: Internet
Author: User
Tags control characters

The quote-printable (qP) method is usually abbreviated as "Q". The principle is
The 8-bit character is represented by two hexadecimal values, and "=" is added to the front ". So we can see that it is encoded by QP.
The following file is usually like this: = B3 = C2 = BF = A1 = C7 = E5 = a3 = ac = C4 = fa = BA = C3 = a3 = A1.
Quoted-printable encryption rules (RFC 1341 ):

1. The character is represented in the format of = XX, where XX is the hexadecimal value of the character,
Must be 0-9 or A-F (with uppercase characters), unless there is a replacement description,
Otherwise, this principle is mandatory.

2. the decimal value is 33-60 & 62-126 (Note: '=' is not included ')
It can be used as standard ASCII without conversion.

3. In addition, the decimal value 9-32 can also be used as tabulation and format control characters,
Therefore, no conversion is performed. (Note: This is not mandatory, that is, it can be converted)

4. The rfc822 Protocol specifies the maximum number of characters in each row of the body text.
Therefore, when the subject text contains a CRLF (carriage return/line feed) or lfcr character sequence,
Or separate CR and LF characters must be converted to the corresponding
"= 0d = 0a", "= 0a = 0d", "= 0d", "= 0a", and so on.

5. (question about soft carriage return) quoted-printable encoding requires that each line be encoded
The maximum number of characters cannot exceed 76 characters. If you want to forward more than the number of characters
Line encoding, you must use soft press Enter. Therefore, the final addition of an encoded row
'=' Indicates that the last '=' is a meaningless soft carriage return. So, such
If the content of an unencoded row is as follows:

Now's the time for all folk to come to the aid of their country.

In quoted-printable, it can be expressed:

Now's the time =
For all folk to come =
To the aid of their country.

It provides a method to encode long lines and restore them to the user's original input content.
Mechanism. Although the CRLF at the end of a row is not included in the limit of 76 characters
Is all other characters, including the '=' symbol.

Because the hyphen '-' indicates itself in quoted-printable encoding
When encoding the body content of a multipart object, we must note that
Purpose: we must not make a boundary identifier appear in the subject part of the encoding!
(A better way is to include a "= _" in boundary so that it will never be repeated.
For more information, see the definition of multipart message in RFC 1341 .)

Note: The quoted-printable encoding is used during mail Transmission.
An encoding that compromises reliability. For email owners using quoted-printable Encoding
Body, the vast majority of mail gateways can work reliably, but it is also possible
It does not work very well on a very small number of email gateways. The most significant thing is that it involves
When the ebcdic is transmitted. (Theoretically, the ebcdic gateway can
Encoding, and then use base64 encoding to re-encode the subject content,
These gateways are not actually available yet .)
For higher requirements, we use base64 encoding. A moderately credible transmission through
The ebcdic gateway uses the following ASCII code according to [Rule 1:

! "# [Email protected] [\] ^ '{| }~

For more information, see [appendix B] of rfc1341.

Because the data encoded by quoted-printable is generally considered line-oriented (line-oriented ),
For data encoded using quoted-printable, we want the line break between the row and the row to be transmitted
Rewrite
We hope that a plain text mail can be converted in different systems.
Internet mail with different line breaks ). If this conversion may result in large raw data
The wise choice is to apply base64 encoding,
To replace quoted-printable encoding!
Lead: http://topic.csdn.net/t/20031008/20/2334682.html

QP (Quote-printable) Encoding

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.