"utf8s" -> "utf8"

master
Charles Iliya Krempeaux 2022-07-18 16:36:02 -07:00
parent e35f8ab59d
commit 2129573f6d
21 changed files with 39 additions and 39 deletions

View File

@ -1,6 +1,6 @@
# go-utf8 # go-utf8
Package **utf8s** provides tools for working with Unicode encoded as UTF-8, for the Go programming language. Package **utf8** provides tools for working with Unicode encoded as UTF-8, for the Go programming language.
## Documention ## Documention
@ -17,7 +17,7 @@ var reader io.Reader
// ... // ...
r, n, err := utf8s.ReadRune(reader) r, n, err := utf8.ReadRune(reader)
``` ```
```go ```go
@ -29,7 +29,7 @@ var r rune
// ... // ...
n, err := utf8s.WriteRune(w, r) n, err := utf8.WriteRune(w, r)
``` ```
```go ```go
@ -37,7 +37,7 @@ var reader io.Reader
// ... // ...
runeReader := utf8s.NewRuneReader(reader) runeReader := utf8.NewRuneReader(reader)
// ... // ...
@ -49,7 +49,7 @@ var reader io.Reader
// ... // ...
runeScanner := utf8s.NewRuneScanner(reader) runeScanner := utf8.NewRuneScanner(reader)
// ... // ...

12
doc.go
View File

@ -1,5 +1,5 @@
/* /*
Package utf8s provides tools for working with Unicode encoded as UTF-8. Package utf8 provides tools for working with Unicode encoded as UTF-8.
Example Example
@ -8,7 +8,7 @@ Example
// ... // ...
r, n, err := utf8s.ReadRune(reader) r, n, err := utf8.ReadRune(reader)
Example Example
@ -21,7 +21,7 @@ Example
// ... // ...
n, err := utf8s.WriteRune(w, r) n, err := utf8.WriteRune(w, r)
Example Example
@ -30,7 +30,7 @@ Example
// ... // ...
runeReader := utf8s.NewRuneReader(reader) runeReader := utf8.NewRuneReader(reader)
// .. // ..
@ -43,7 +43,7 @@ Example
// ... // ...
runeScanner := utf8s.NewRuneScanner(reader) runeScanner := utf8.NewRuneScanner(reader)
// ... // ...
@ -120,4 +120,4 @@ This is done as described in the following table:
*/ */
package utf8s package utf8

View File

@ -1,4 +1,4 @@
package utf8s package utf8
import ( import (
"errors" "errors"

View File

@ -1,4 +1,4 @@
package utf8s package utf8
import ( import (
"bytes" "bytes"
@ -8,7 +8,7 @@ import (
// //
// Example // Example
// //
// utf8s.FormatBinary('۵') // utf8.FormatBinary('۵')
// //
// // Outputs: // // Outputs:
// // <<0b11011011 ; 0b10110101>> // // <<0b11011011 ; 0b10110101>>

View File

@ -1,4 +1,4 @@
package utf8s package utf8
import ( import (
"testing" "testing"

View File

@ -1,4 +1,4 @@
package utf8s package utf8
type InvalidUTF8Complainer interface { type InvalidUTF8Complainer interface {
error error

10
len.go
View File

@ -1,28 +1,28 @@
package utf8s package utf8
// Len returns the number of bytes in a UTF-8 encoding of this Unicode code point. // Len returns the number of bytes in a UTF-8 encoding of this Unicode code point.
// //
// Example // Example
// //
// length := utf8s.Len('A') // length := utf8.Len('A')
// //
// // length == 1 // // length == 1
// //
// Example // Example
// //
// length := utf8s.Len('r') // length := utf8.Len('r')
// //
// // length == 1 // // length == 1
// //
// Example // Example
// //
// length := utf8s.Len('¡') // length := utf8.Len('¡')
// //
// // length == 2 // // length == 2
// //
// Example // Example
// //
// length := utf8s.Len('۵') // length := utf8.Len('۵')
// //
// // length == 2 // // length == 2
func Len(r rune) int { func Len(r rune) int {

View File

@ -1,4 +1,4 @@
package utf8s package utf8
import ( import (
"testing" "testing"

View File

@ -1,4 +1,4 @@
package utf8s package utf8
type NilReaderComplainer interface { type NilReaderComplainer interface {
error error

View File

@ -1,4 +1,4 @@
package utf8s package utf8
type NilWriterComplainer interface { type NilWriterComplainer interface {
error error

View File

@ -1,4 +1,4 @@
package utf8s package utf8
import ( import (
"io" "io"

View File

@ -1,4 +1,4 @@
package utf8s package utf8
import ( import (
"io" "io"

View File

@ -1,4 +1,4 @@
package utf8s package utf8
const ( const (
RuneError = '\uFFFD' // Unicode Replacement Character (U+FFFD). RuneError = '\uFFFD' // Unicode Replacement Character (U+FFFD).

View File

@ -1,10 +1,10 @@
package utf8s package utf8
import ( import (
"io" "io"
) )
// A utf8s.RuneReader implements the io.RuneReader interface by reading from an io.Reader. // A utf8.RuneReader implements the io.RuneReader interface by reading from an io.Reader.
type RuneReader struct { type RuneReader struct {
reader io.Reader reader io.Reader
} }

View File

@ -1,4 +1,4 @@
package utf8s package utf8
import ( import (
"io" "io"

View File

@ -1,10 +1,10 @@
package utf8s package utf8
import ( import (
"io" "io"
) )
// A utf8s.RuneScanner implements the io.RuneScanner interface by reading from an io.Reader. // A utf8.RuneScanner implements the io.RuneScanner interface by reading from an io.Reader.
type RuneScanner struct { type RuneScanner struct {
reader io.Reader reader io.Reader

View File

@ -1,4 +1,4 @@
package utf8s package utf8
import ( import (
"io" "io"

View File

@ -1,4 +1,4 @@
package utf8s package utf8
import ( import (
"io" "io"

View File

@ -1,4 +1,4 @@
package utf8s_test package utf8_test
import ( import (
"github.com/reiver/go-utf8" "github.com/reiver/go-utf8"
@ -58,7 +58,7 @@ func TestRuneWriter(t *testing.T) {
var buffer strings.Builder var buffer strings.Builder
var total int var total int
runeWriter := utf8s.NewRuneWriter(&buffer) runeWriter := utf8.NewRuneWriter(&buffer)
for runeNumber, r := range test.Runes { for runeNumber, r := range test.Runes {
@ -73,7 +73,7 @@ func TestRuneWriter(t *testing.T) {
continue TestLoop continue TestLoop
} }
if expected, actual := n, utf8s.Len(r); expected != actual { if expected, actual := n, utf8.Len(r); expected != actual {
t.Errorf("For test #%d and rune #%d, expected a certain number of bytes to be written, but actually wasn't.", testNumber, runeNumber) t.Errorf("For test #%d and rune #%d, expected a certain number of bytes to be written, but actually wasn't.", testNumber, runeNumber)
for i, rr := range test.Runes { for i, rr := range test.Runes {
t.Logf("\t[%d] %q (%d)", i, string(rr), rr) t.Logf("\t[%d] %q (%d)", i, string(rr), rr)

View File

@ -1,4 +1,4 @@
package utf8s package utf8
import ( import (
"io" "io"

View File

@ -1,4 +1,4 @@
package utf8s package utf8
import ( import (
"bytes" "bytes"