Source File
reader.go
Belonging Package
mime/quotedprintable
package quotedprintable
import (
)
case >= 'a' && <= 'f':
return - 'a' + 10, nil
}
return 0, fmt.Errorf("quotedprintable: invalid hex byte 0x%02x", )
}
func ( []byte) ( byte, error) {
if len() < 2 {
return 0, io.ErrUnexpectedEOF
}
var , byte
if , = fromHex([0]); != nil {
return 0,
}
if , = fromHex([1]); != nil {
return 0,
}
return <<4 | , nil
}
func ( rune) bool {
switch {
case '\n', '\r', ' ', '\t':
return true
}
return false
}
var (
crlf = []byte("\r\n")
lf = []byte("\n")
softSuffix = []byte("=")
)
:= bytes.HasSuffix(.line, lf)
:= bytes.HasSuffix(.line, crlf)
:= .line
.line = bytes.TrimRightFunc(, isQPDiscardWhitespace)
if bytes.HasSuffix(.line, softSuffix) {
:= [len(.line):]
.line = .line[:len(.line)-1]
if !bytes.HasPrefix(, lf) && !bytes.HasPrefix(, crlf) &&
!(len() == 0 && len(.line) > 0 && .rerr == io.EOF) {
.rerr = fmt.Errorf("quotedprintable: invalid bytes after =: %q", )
}
} else if {
if {
.line = append(.line, '\r', '\n')
} else {
.line = append(.line, '\n')
}
}
continue
}
:= .line[0]
switch {
case == '=':
, = readHexByte(.line[1:])
if != nil {
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |