charset

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(s []byte, enc string) (string, error)

DecodeBytes converts given bytes to a UTF-8 string

func DecodeBytes

func DecodeBytes(s []byte, enc string) (string, error)

DecodeBytes converts given bytes to a UTF-8 string

func DecodeReader

func DecodeReader(s io.Reader, enc string) (string, error)

DecodeReader converts given Reader to a UTF-8 string

func DecodeReaderBytes

func DecodeReaderBytes(s io.Reader, enc string) ([]byte, error)

func DecodeString

func DecodeString(s, enc string) (string, error)

DecodeString converts given string to a UTF-8 string

func Encode

func Encode(s string, enc string) ([]byte, error)

Encode converts a string to bytes encoded with given encoding

func EncodeBytes

func EncodeBytes(s []byte, enc string) ([]byte, error)

EncodeBytes converts bytes to bytes encoded with given encoding

func EncodeReader

func EncodeReader(s io.Reader, enc string) ([]byte, error)

EncodeReader converts a Reader to bytes encoded with given encoding

func EncodeString

func EncodeString(s, enc string) ([]byte, error)

EncodeString converts a string to bytes encoded with given encoding

func MustDecode

func MustDecode(s []byte, enc string) string

MustDecodeBytes converts given bytes to a UTF-8 string and panics if errros occur.

func MustDecodeBytes

func MustDecodeBytes(s []byte, enc string) []byte

MustDecodeBytes converts given bytes to a UTF-8 string and panics if errros occur.

func MustDecodeReader

func MustDecodeReader(s io.Reader, enc string) string

MustDecodeReader converts given Reader to a UTF-8 string and panics if errros occur.

func MustDecodeString

func MustDecodeString(s, enc string) string

MustDecodeString converts given string to a UTF-8 string and panics if errros occur.

func MustEncode

func MustEncode(s string, enc string) []byte

MustEncode converts a bytes to bytes encoded with given encoding and panics if errors occur

func MustEncodeBytes

func MustEncodeBytes(s []byte, enc string) []byte

MustEncodeBytes converts a bytes to bytes encoded with given encoding and panics if errors occur

func MustEncodeReader

func MustEncodeReader(s io.Reader, enc string) []byte

MustEncodeReader converts a Reader to bytes encoded with given encoding and panics if errors occur

func MustEncodeString

func MustEncodeString(s, enc string) []byte

MustEncodeString converts a bytes to bytes encoded with given encoding and panics if errors occur

Types

type CharsetGuess

type CharsetGuess interface {
	// Charset returns a guessed charcter set
	Charset() string

	// Language returns a guessed language
	Language() string

	// Confidence returns a confidence of this guess
	Confidence() int
}

CharsetGuess is a guessd charcter set

func Guess

func Guess(s []byte) (CharsetGuess, error)

Guess guesses a character set of given bytes

func GuessBytes

func GuessBytes(s []byte) (CharsetGuess, error)

GuessBytes guesses a character set of given bytes

func GuessReader

func GuessReader(s io.Reader) (CharsetGuess, error)

GuessBytes guesses a character set of given Reader

func GuessString

func GuessString(s string) (CharsetGuess, error)

GuessBytes guesses a character set of given string

Jump to

Keyboard shortcuts

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