go/src/mime/encodedword.go

type WordEncoder

const BEncoding

const QEncoding

var errInvalidWord

// Encode returns the encoded-word form of s. If s is ASCII without special
// characters, it is returned unchanged. The provided charset is the IANA
// charset name of s. It is case insensitive.
func (e WordEncoder) Encode(charset, s string) string {}

func needsEncoding(s string) bool {}

// encodeWord encodes a string into an encoded-word.
func (e WordEncoder) encodeWord(charset, s string) string {}

const maxEncodedWordLen

const maxContentLen

var maxBase64Len

// bEncode encodes s using base64 encoding and writes it to buf.
func (e WordEncoder) bEncode(buf *strings.Builder, charset, s string) {}

// qEncode encodes s using Q encoding and writes it to buf. It splits the
// encoded-words when necessary.
func (e WordEncoder) qEncode(buf *strings.Builder, charset, s string) {}

// writeQString encodes s using Q encoding and writes it to buf.
func writeQString(buf *strings.Builder, s string) {}

// openWord writes the beginning of an encoded-word into buf.
func (e WordEncoder) openWord(buf *strings.Builder, charset string) {}

// closeWord writes the end of an encoded-word into buf.
func closeWord(buf *strings.Builder) {}

// splitWord closes the current encoded-word and opens a new one.
func (e WordEncoder) splitWord(buf *strings.Builder, charset string) {}

func isUTF8(charset string) bool {}

const upperhex

type WordDecoder

// Decode decodes an RFC 2047 encoded-word.
func (d *WordDecoder) Decode(word string) (string, error) {}

// DecodeHeader decodes all encoded-words of the given string. It returns an
// error if and only if [WordDecoder.CharsetReader] of d returns an error.
func (d *WordDecoder) DecodeHeader(header string) (string, error) {}

func decode(encoding byte, text string) ([]byte, error) {}

func (d *WordDecoder) convert(buf *strings.Builder, charset string, content []byte) error {}

// hasNonWhitespace reports whether s (assumed to be ASCII) contains at least
// one byte of non-whitespace.
func hasNonWhitespace(s string) bool {}

// qDecode decodes a Q encoded string.
func qDecode(s string) ([]byte, error) {}

// readHexByte returns the byte from its quoted-printable representation.
func readHexByte(a, b byte) (byte, error) {}

func fromHex(b byte) (byte, error) {}