Standard library / mime
mime.WordDecoder
Decode RFC 2047 encoded words in message headers. CharsetReader can supply additional charset conversions; the default handles UTF-8, ISO-8859-1 and US-ASCII. Expected stdout: 'café\n'.
Formal Syntax & Structure
go syntaxgo
type WordDecoder struct { CharsetReader func(charset string, input io.Reader) (io.Reader, error)}Working Example
Example Snippetgo
package main
import ( "fmt" "mime")
func main() { var d mime.WordDecoder; fmt.Println(must(d.Decode("=?UTF-8?Q?caf=C3=A9?="))) }
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}