pycodecs

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(data []byte, name string) (string, error)

bytes.decode with errors strict through the CPython codec registry

func DecodeReplace

func DecodeReplace(data []byte, name string) (string, error)

bytes.decode with errors replace, each undecodable byte becoming U+FFFD as the CPython codecs do

func Encode

func Encode(text, name string) (string, error)

str.encode with errors strict through the CPython codec registry

func GetEncoding

func GetEncoding() string

locale.getencoding, the LC_CTYPE codeset whatever the UTF-8 mode, a C locale coerced only while LC_ALL is unset

func InfoName

func InfoName(name string) (string, bool)

CodecInfo name codecs.lookup gives for a name, false when no codec answers it

func LocaleEncoding

func LocaleEncoding() string

locale.getencoding after the PEP 538 coercion, the LC_CTYPE codeset or utf-8 for the C locale

func Lookup

func Lookup(name string) (string, bool)

Module of the encodings package that answers name, alias first like encodings.search_function

Types

type LookupError

type LookupError struct {
	Name    string
	NotText string
}

LookupError is the codecs.lookup failure for an unknown name, or a bytes codec refused by the NotText operation

func (*LookupError) Error

func (e *LookupError) Error() string

type UnicodeDecodeError

type UnicodeDecodeError struct {
	Codec  string
	Byte   byte
	Pos    int
	Reason string
	End    int
	Len    int
	// Positions past the int range a punycode error can carry, used instead of Pos and End when set
	BigPos, BigEnd *big.Int
}

UnicodeDecodeError is the strict decode failure over bytes Pos to End of input Len long, End zero meaning one

func (*UnicodeDecodeError) Error

func (e *UnicodeDecodeError) Error() string

type UnicodeEncodeError

type UnicodeEncodeError struct {
	Codec      string
	Char       rune
	Start, End int
	Reason     string
	Len        int
}

UnicodeEncodeError is the strict encode failure over characters Start to End, Len the text length when known

func (*UnicodeEncodeError) Error

func (e *UnicodeEncodeError) Error() string

type UnicodeError

type UnicodeError struct{ Msg string }

UnicodeError of a codec refusing an operation outright

func (*UnicodeError) Error

func (e *UnicodeError) Error() string

func (*UnicodeError) PyTypeName

func (e *UnicodeError) PyTypeName() string

Jump to

Keyboard shortcuts

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