pmmime

package
v3.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyContentTypeErr = errors.New("empty content type")
View Source
var ErrBadUTF7 = errors.New("utf7: bad utf-7 encoding")

ErrBadUTF7 is returned to indicate the invalid modified UTF-7 encoding.

Functions

func CharsetReader

func CharsetReader(charset string, input io.Reader) (io.Reader, error)

func DecodeCharset

func DecodeCharset(original []byte, contentType string) ([]byte, error)

DecodeCharset decodes the original using content type parameters. If the charset parameter is missing it checks that the content is valid utf8. If it isn't, it checks if it's embedded in the html/xml. If it isn't, it falls back to windows-1252. It then reencodes it as utf-8.

func DecodeHeader

func DecodeHeader(raw string) (decoded string, err error)

DecodeHeader if needed. Returns error if raw contains non-utf8 characters.

func EncodeHeader

func EncodeHeader(s string) string

EncodeHeader using quoted printable and utf8.

func NewUtf7Decoder

func NewUtf7Decoder() *encoding.Decoder

NewUtf7Decoder returns a new decoder for utf7.

func ParseMediaType

func ParseMediaType(v string) (string, map[string]string, error)

ParseMediaType from MIME doesn't support RFC2231 for non asci / utf8 encodings so we have to pre-parse it.

func SelectDecoder

func SelectDecoder(charset string) (decoder *encoding.Decoder, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL