...
Package quotedprintable
Package quotedprintable implements quoted-printable encoding as specified by
RFC 2045.
In the call graph viewer below, each node
is a function belonging to this package
and its children are the functions it
calls—perhaps dynamically.
The root nodes are the entry points of the
package: functions that may be called from
outside the package.
There may be non-exported or anonymous
functions among them if they are called
dynamically from another package.
Click a node to visit that function's source code.
From there you can visit its callers by
clicking its declaring func
token.
Functions may be omitted if they were
determined to be unreachable in the
particular programs or tests that were
analyzed.
Reader is a quoted-printable decoder.
type Reader struct {
}
func NewReader(r io.Reader) *Reader
NewReader returns a quoted-printable reader, decoding from r.
▾ Example
Code:
for _, s := range []string{
`=48=65=6C=6C=6F=2C=20=47=6F=70=68=65=72=73=21`,
`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)
}
Output:
Hello, Gophers! <nil>
invalid escape: <b style="font-size: 200%">hello</b> <nil>
Hello, Gophers! This symbol will be unescaped: = and this will be written in one line. <nil>
func (*Reader) Read
¶
func (r *Reader) Read(p []byte) (n int, err error)
Read reads and decodes quoted-printable data from the underlying reader.
A Writer is a quoted-printable writer that implements io.WriteCloser.
type Writer struct {
Binary bool
}
func NewWriter(w io.Writer) *Writer
NewWriter returns a new Writer that writes to w.
▾ Example
Code:
w := quotedprintable.NewWriter(os.Stdout)
w.Write([]byte("These symbols will be escaped: = \t"))
w.Close()
Output:
These symbols will be escaped: =3D =09
func (*Writer) Close
¶
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) Write
¶
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.