internal/coding/quotedprint.go
func (qp *QPCleaner) Read(dest []byte) (n int, err error) {
	// Ensure room to write a byte or =XX string.
	destLen := len(dest) - 3
	// Loop over bytes in qp.in ByteReader.
	for n < destLen {
		b, err := qp.in.ReadByte()
		if err != nil {
			return n, err
		}
		switch {
		case b == '=':
			// Pass valid hex bytes through.
			hexBytes, err := qp.in.Peek(2)
			if err != nil && err != io.EOF {
				return 0, err
			}
			if validHexBytes(hexBytes) {
				dest[n] = b
				n++
			} else {
				s := fmt.Sprintf("=%02X", b)
				n += copy(dest[n:], s)
			}
		case b == '\t' || b == '\r' || b == '\n':
			// Valid special character.
			dest[n] = b
			n++
		case b < ' ' || '~' < b:
			// Invalid character, render quoted-printable into buffer.
			s := fmt.Sprintf("=%02X", b)
			n += copy(dest[n:], s)
		default:
			// Acceptable character.
			dest[n] = b
			n++
		}
	}
	return n, err
}
func (qp *QPCleaner) Read(dest []byte) (n int, err error) {
	// Ensure room to write a byte or =XX string.
	destLen := len(dest) - 3
	// Loop over bytes in qp.in ByteReader.
	for n < destLen {
		b, err := qp.in.ReadByte()
		if err != nil {
			return n, err
		}
		switch {
		case b == '=':
			// Pass valid hex bytes through.
			hexBytes, err := qp.in.Peek(2)
			if err != nil && err != io.EOF {
				return 0, err
			}
			if validHexBytes(hexBytes) {
				dest[n] = b
				n++
			} else {
				s := fmt.Sprintf("=%02X", b)
				n += copy(dest[n:], s)
			}
		case b == '\t' || b == '\r' || b == '\n':
			// Valid special character.
			dest[n] = b
			n++
		case b < ' ' || '~' < b:
			// Invalid character, render quoted-printable into buffer.
			s := fmt.Sprintf("=%02X", b)
			n += copy(dest[n:], s)
		default:
			// Acceptable character.
			dest[n] = b
			n++
		}
	}
	return n, err
}
// Read method for io.Reader interface.