Standard library / mime
mime.WordEncoder.Encode()
Encode text in RFC 2047 encoded-word form. Suitable ASCII text is unchanged. The charset label must describe the actual input bytes. Expected stdout: '=?UTF-8?q?caf=C3=A9?=\n'.
Formal Syntax & Structure
go syntaxgo
func (e WordEncoder) Encode(charset, s string) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| charset | string | IANA character-set name for the supplied text. |
| s | string | Input string to process. |
Return Value
string
Encoded-word text or unchanged suitable ASCII.
Working Example
Example Snippetgo
package main
import ( "fmt" "mime")
func main() { fmt.Println(mime.QEncoding.Encode("UTF-8", "café")) }
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) }}