File tree 1 file changed +37
-0
lines changed 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
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
+ package quotedprintable_test
6
+
7
+ import (
8
+ "fmt"
9
+ "io/ioutil"
10
+ "mime/quotedprintable"
11
+ "os"
12
+ "strings"
13
+ )
14
+
15
+ func ExampleNewReader () {
16
+ for _ , s := range []string {
17
+ `=48=65=6C=6C=6F=2C=20=47=6F=70=68=65=72=73=21` ,
18
+ `invalid escape: =B` ,
19
+ "Hello, Gophers! This symbol will be unescaped: =3D and this will be written in =\r \n one line." ,
20
+ } {
21
+ b , err := ioutil .ReadAll (quotedprintable .NewReader (strings .NewReader (s )))
22
+ fmt .Printf ("%s %v\n " , b , err )
23
+ }
24
+ // Output:
25
+ // Hello, Gophers! <nil>
26
+ // invalid escape: unexpected EOF
27
+ // Hello, Gophers! This symbol will be unescaped: = and this will be written in one line. <nil>
28
+ }
29
+
30
+ func ExampleNewWriter () {
31
+ w := quotedprintable .NewWriter (os .Stdout )
32
+ w .Write ([]byte ("These symbols will be escaped: = \t " ))
33
+ w .Close ()
34
+
35
+ // Output:
36
+ // These symbols will be escaped: =3D =09
37
+ }
You can’t perform that action at this time.
0 commit comments