Documentation
¶
Overview ¶
Package bodies decodes MHT section bodies according to their Content-Transfer-Encoding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeQuotedPrintableLine ¶
DecodeQuotedPrintableLine decodes a single quoted-printable encoded line (without its trailing CRLF). A hard line break appends CRLF to the result; a soft line break (trailing "=") appends nothing, so consecutive decoded lines concatenate into the original text.
The standard library's quotedprintable.Reader is not used here: it is stream-oriented and normalizes input in ways that break byte-identical round trips of Blink-generated MHTML.
func Scan ¶
func Scan(scanner *bufio.Scanner, boundary string, encoding TransferEncoding, body *strings.Builder) error
Scan reads body lines from scanner into body until it reaches the next boundary. Base64 lines are concatenated without line breaks, quoted-printable lines are decoded (a missing encoding is treated as quoted-printable, matching Blink output where the header is sometimes stripped), and any other encoding is passed through unchanged.
Scan returns nil when it stops at an intermediate boundary and io.EOF when it stops at the closing boundary or the end of input.
Types ¶
type TransferEncoding ¶
type TransferEncoding string
TransferEncoding is the value of a section's Content-Transfer-Encoding header.
const ( QuotedPrintable TransferEncoding = "quoted-printable" Base64 TransferEncoding = "base64" )
Transfer encodings that receive special handling. Anything else is treated as an identity encoding and passed through unchanged.