Package quotedprintable


Package quotedprintable implements quoted-printable encoding as specified by RFC 2045.




Package files

reader.go writer.go

type ReaderSource 1.5

Reader is a quoted-printable decoder.

type Reader struct {
    // contains filtered or unexported fields

func NewReaderSource 1.5

func NewReader(r io.Reader) *Reader

NewReader returns a quoted-printable reader, decoding from r.


package main

import (

func main() {
	for _, s := range []string{
		`invalid escape: <b style="font-size: 200%">hello</b>`,
		"Hello, Gophers! This symbol will be unescaped: =3D and this will be written in =\r\none line.",
	} {
		b, err := ioutil.ReadAll(quotedprintable.NewReader(strings.NewReader(s)))
		fmt.Printf("%s %v\n", b, err)

func (*Reader) ReadSource 1.5

func (r *Reader) Read(p []byte) (n int, err error)

Read reads and decodes quoted-printable data from the underlying reader.

type WriterSource 1.5

A Writer is a quoted-printable writer that implements io.WriteCloser.

type Writer struct {
    // Binary mode treats the writer's input as pure binary and processes end of
    // line bytes as binary data.
    Binary bool
    // contains filtered or unexported fields

func NewWriterSource 1.5

func NewWriter(w io.Writer) *Writer

NewWriter returns a new Writer that writes to w.


package main

import (

func main() {
	w := quotedprintable.NewWriter(os.Stdout)
	w.Write([]byte("These symbols will be escaped: = \t"))


func (*Writer) CloseSource 1.5

func (w *Writer) Close() error

Close closes the Writer, flushing any unwritten data to the underlying io.Writer, but does not close the underlying io.Writer.

func (*Writer) WriteSource 1.5

func (w *Writer) Write(p []byte) (n int, err error)

Write encodes p using quoted-printable encoding and writes it to the underlying io.Writer. It limits line length to 76 characters. The encoded bytes are not necessarily flushed until the Writer is closed.

© Google, Inc.
Licensed under the Creative Commons Attribution License 3.0.