1// Copyright 2016 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// +build ignore 6 7package quotedprintable_test 8 9import ( 10 "fmt" 11 "io/ioutil" 12 "mime/quotedprintable" 13 "os" 14 "strings" 15) 16 17func ExampleNewReader() { 18 for _, s := range []string{ 19 `=48=65=6C=6C=6F=2C=20=47=6F=70=68=65=72=73=21`, 20 `invalid escape: <b style="font-size: 200%">hello</b>`, 21 "Hello, Gophers! This symbol will be unescaped: =3D and this will be written in =\r\none line.", 22 } { 23 b, err := ioutil.ReadAll(quotedprintable.NewReader(strings.NewReader(s))) 24 fmt.Printf("%s %v\n", b, err) 25 } 26 // Output: 27 // Hello, Gophers! <nil> 28 // invalid escape: <b style="font-size: 200%">hello</b> <nil> 29 // Hello, Gophers! This symbol will be unescaped: = and this will be written in one line. <nil> 30} 31 32func ExampleNewWriter() { 33 w := quotedprintable.NewWriter(os.Stdout) 34 w.Write([]byte("These symbols will be escaped: = \t")) 35 w.Close() 36 37 // Output: 38 // These symbols will be escaped: =3D =09 39} 40