text

package
v0.27.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ISO8859_1 encoding.Encoding = cmap("ISO8859-1")

ISO8859_1 is the Encoding for ISO-8859-1

Functions

func Decode

func Decode(p []byte, enc encoding.Encoding) (string, error)

Decode decodes the bytes from enc to utf8 (an allocating, convenience version of transform.Transform).

func Encode

func Encode(p string, enc encoding.Encoding) ([]byte, error)

Encode encodes the bytes from utf8 to the given encoding (an allocating, convenience version of transform.Transform).

func GetEncoding

func GetEncoding(name string) encoding.Encoding

GetEncoding returns the encoding.Encoding for the text name of the encoding Returns nil if the encoding is not found.

Knows the ISO8859 family, KOI8, Windows and Mac codepages, but misses other Asian codepages

func NewDecodingReader

func NewDecodingReader(r io.Reader, enc encoding.Encoding) io.Reader

NewDecodingReader is a deprecated, it has been renamed to NewReader.

func NewEncodingWriter

func NewEncodingWriter(w io.Writer, enc encoding.Encoding) io.WriteCloser

NewEncodingWriter is deprecated, has been renamed to NewWriter.

func NewReader

func NewReader(r io.Reader, enc encoding.Encoding) io.Reader

NewReader returns a reader which decode from the given encoding, to utf8.

If enc is nil, then only an utf8-enforcing replacement reader (see http://godoc.org/code.google.com/p/go.text/encoding#pkg-variables) is used.

func NewStringReader

func NewStringReader(r io.Reader) io.Reader

NewStringReader wraps an io.Reader which reads UTF-8, and splits reads between valid runes, never inside a rune.

func NewWriter

func NewWriter(w io.Writer, enc encoding.Encoding) io.WriteCloser

NewWriter returns a writer which encodes to the given encoding, utf8.

If enc is nil, then only an utf8-enforcing replacement writer (see http://godoc.org/code.google.com/p/go.text/encoding#pkg-variables) is used.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL