encoding

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package encoding provides a replacement encoder and decoder for use with mime.CharsetEncoder and mime.CharsetDecoder. This loads all the encodings provided with:

* golang.org/x/text/encoding/ianaindex

This will make the size of your compiled binaries considerably larger. But it will also give your code the ability to encode and decode pretty much any character set it might encounter in the wild wild world of email.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CharsetDecoder

func CharsetDecoder(charset string, b []byte) (string, error)

CharsetDecoder provides a replacement decoder for mime.CharsetDecoder, which can decode a wide range of rare and unusual character sets.

func CharsetEncoder

func CharsetEncoder(charset, s string) ([]byte, error)

CharsetEncoder provides a replacement encoder for mime.CharsetEncoder, which can encode a wide range of rare and unusual character sets.

func GenerateBoundary

func GenerateBoundary() string

GenerateBoundary will generate a random MIME boundary that is probably unique in most circumstances.

func GenerateSafeBoundary

func GenerateSafeBoundary(contents string) string

GenerateSafeBoundary will generate a random MIME boundary that is guaranteed to be safe with the given corpus of data. Use this when you want to generate a boundary for a known set of parts:

boundary := encoding.GenerateSafeBoundary(strings.Join("", parts))

using this is likely to be total overkill, but in case you're paranoid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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