diff options
Diffstat (limited to 'src/strings/strings.go')
| -rw-r--r-- | src/strings/strings.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/strings/strings.go b/src/strings/strings.go index 1dc4238522..013d718426 100644 --- a/src/strings/strings.go +++ b/src/strings/strings.go @@ -15,7 +15,7 @@ import ( // explode splits s into a slice of UTF-8 strings, // one string per Unicode character up to a maximum of n (n < 0 means no limit). -// Invalid UTF-8 sequences become correct encodings of U+FFFD. +// Invalid UTF-8 bytes are sliced individually. func explode(s string, n int) []string { l := utf8.RuneCountInString(s) if n < 0 || n > l { @@ -23,12 +23,9 @@ func explode(s string, n int) []string { } a := make([]string, n) for i := 0; i < n-1; i++ { - ch, size := utf8.DecodeRuneInString(s) + _, size := utf8.DecodeRuneInString(s) a[i] = s[:size] s = s[size:] - if ch == utf8.RuneError { - a[i] = string(utf8.RuneError) - } } if n > 0 { a[n-1] = s |
