Standard library / mime/quotedprintable

quotedprintable.NewWriter()

Wrap a destination with a quoted-printable encoder. Close the encoder to flush pending bytes. Expected stdout: 'caf=C3=A9\n'.

Formal Syntax & Structure

go syntaxgo
func NewWriter(w io.Writer) *Writer

Parameters & Attributes

NameTypeDescription
wio.WriterUnderlying destination stream.

Return Value

*Writer

Writer wrapping the destination.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt"  "io"  "mime/quotedprintable")
func main() {  var b bytes.Buffer  w := quotedprintable.NewWriter(&b)  must(io.WriteString(w, "café"))  check(w.Close())  fmt.Println(b.String())}
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)  }}
Go Reference