package quotedprintable
import "mime/quotedprintable"
Package quotedprintable implements quoted-printable encoding as specified by RFC 2045.
Index ¶
Examples ¶
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is a quoted-printable decoder.
func NewReader ¶
NewReader returns a quoted-printable reader, decoding from r.
Code:play
Output:Example¶
package main
import (
"fmt"
"io"
"mime/quotedprintable"
"strings"
)
func main() {
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 := io.ReadAll(quotedprintable.NewReader(strings.NewReader(s)))
fmt.Printf("%s %v\n", b, err)
}
}
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 ¶
Read reads and decodes quoted-printable data from the underlying reader.
type Writer ¶
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 }
A Writer is a quoted-printable writer that implements io.WriteCloser.
func NewWriter ¶
NewWriter returns a new Writer that writes to w.
func (*Writer) Close ¶
Close closes the Writer, flushing any unwritten data to the underlying io.Writer, but does not close the underlying io.Writer.
func (*Writer) Write ¶
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.
Source Files ¶
- Version
- v1.24.0 (latest)
- Published
- Feb 10, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 16 minutes ago –
Tools for package owners.