equal
deleted
inserted
replaced
10 "sort" |
10 "sort" |
11 "strconv" |
11 "strconv" |
12 "strings" |
12 "strings" |
13 "time" |
13 "time" |
14 "unicode" |
14 "unicode" |
|
15 |
|
16 "github.com/pelletier/go-toml/v2/internal/characters" |
15 ) |
17 ) |
16 |
18 |
17 // Marshal serializes a Go value as a TOML document. |
19 // Marshal serializes a Go value as a TOML document. |
18 // |
20 // |
19 // It is a shortcut for Encoder.Encode() with the default options. |
21 // It is a shortcut for Encoder.Encode() with the default options. |
435 } |
437 } |
436 |
438 |
437 func needsQuoting(v string) bool { |
439 func needsQuoting(v string) bool { |
438 // TODO: vectorize |
440 // TODO: vectorize |
439 for _, b := range []byte(v) { |
441 for _, b := range []byte(v) { |
440 if b == '\'' || b == '\r' || b == '\n' || invalidAscii(b) { |
442 if b == '\'' || b == '\r' || b == '\n' || characters.InvalidAscii(b) { |
441 return true |
443 return true |
442 } |
444 } |
443 } |
445 } |
444 return false |
446 return false |
445 } |
447 } |