Go 语言

Go 语言教程 Go 语言环境安装 Go 语言结构 Go 语言基础语法 Go 语言数据类型 Go 语言变量 Go 语言常量 Go 语言运算符 Go 语言条件语句 Go 语言 if 语句 Go 语言 if...else 语句 Go 语言 if 语句嵌套 Go 语言 switch 语句 Go 语言 select 语句 Go 语言循环语句 Go 语言 for 循环 Go 语言循环嵌套 Go 语言 break 语句 Go 语言 continue 语句 Go 语言 goto 语句 Go 语言函数 Go 语言函数值传递值 Go 语言函数引用传递值 Go 语言函数作为值 Go 语言函数闭包 Go 语言函数方法 Go 语言变量作用域 Go 语言数组 Go 语言多维数组 Go 语言向函数传递数组 Go 语言指针 Go 语言指针数组 Go 语言指向指针的指针 Go 语言指针作为函数参数 Go 语言结构体 Go 语言切片(Slice) Go 语言范围(Range) Go 语言Map(集合) Go 语言递归函数 Go 语言类型转换 Go 语言接口 Go 错误处理 Go 语言开发工具Go 语言标准库

Go 语言标准库


package quotedprintable

import "mime/quotedprintable"

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

Examples

Package Files

reader.go writer.go

type Reader Uses

type Reader struct {
    // contains filtered or unexported fields
}

Reader is a quoted-printable decoder.

func NewReader Uses

func NewReader(r io.Reader) *Reader

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

Code:play 

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 Uses

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

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

type Writer Uses

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 Uses

func NewWriter(w io.Writer) *Writer

NewWriter returns a new Writer that writes to w.

Code:play 

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 Uses

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 Uses

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.