Documentation ¶
Overview ¶
Package table creates a table of all the characters in the named 8-bit character set.
Index ¶
- Variables
- func Alias(alias, value string, e encoding.Encoding) (string, error)
- func Character(cp encoding.Encoding, code int, r rune) string
- func CharmapAlias(cp encoding.Encoding) string
- func Charmaps() []encoding.Encoding
- func CodePage(s string) (encoding.Encoding, error)
- func Footnote(w io.Writer, name string)
- func Language(e encoding.Encoding) string
- func List(wr io.Writer) error
- func ListLanguage(wr io.Writer) error
- func Numeric(name string) int
- func Replacement(name string, code int) string
- func SHY173(name string) bool
- func SHY240(x encoding.Encoding) bool
- func Table(wr io.Writer, name string) error
- func Uniform(mime string) string
- type Lang
- type Row
Examples ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Alias ¶
Alias returns an alias for a encoding. Only the alias argument is required.
Example ¶
package main import ( "fmt" "github.com/bengarrett/retrotxtgo/table" ) func main() { s, _ := table.Alias("", "cp437", nil) fmt.Println(s) }
Output: msdos
func CharmapAlias ¶
CharmapAlias humanizes encodings.
func CodePage ¶
CodePage returns the encoding of the code page name or alias. But without any of the custom, ASA ASCII or ISO-8859-11 encodings.
func Footnote ¶
Footnote writes a footnote with extra details or corrections for the named code page or encoding. It is called by Table.
func Language ¶
Language returns the natural language usge of the encoding.
Example ¶
package main import ( "fmt" "github.com/bengarrett/retrotxtgo/table" "golang.org/x/text/encoding/charmap" ) func main() { l := table.Language(charmap.CodePage437) fmt.Print(l) }
Output: US English
func ListLanguage ¶
ListLanguage writes a tabled list of supported IANA character set encodings and the languages they target.
func Numeric ¶
Numeric returns a numeric alias for a character encoding. A -1 int is returned whenever an alias could not be generated. Unicode based encodings always return -1.
func Replacement ¶
Replacement returns a replacement character for the code page.
Types ¶
type Lang ¶
Lang describes the common natural language uses of the encoding.
func Languages ¶
func Languages() Lang
Languages returns a list of code page encodings and their target natural languages.
Example ¶
package main import ( "fmt" "github.com/bengarrett/retrotxtgo/table" "golang.org/x/text/encoding/charmap" ) func main() { l := table.Languages() fmt.Print(l[charmap.CodePage437]) }
Output: US English
type Row ¶
type Row struct { Name string // Name is the formal name of the character encoding. Value string // Value is the short name of the character encoding. Numeric string // Numeric is an optional, shorter numeric value of the character encoding. Alias string // Alias is an optional, informal but common use value of the character encoding. }
Row is an item for the list of code pages.