charset

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 2 Imported by: 0

README

⚠ This package is deprecated, please use golang.org/x/text/encoding/charmap instead.


See documentation on GoDoc

License: MIT

Documentation

Overview

The charset package provides encoding/decoding functions for single-byte character sets.

Index

Constants

This section is empty.

Variables

View Source
var ASCII = New(table_ASCII)

ASCII charset

View Source
var CP1251 = New(table_CP1251)

CP1251 charset, see http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT

View Source
var CP1252 = New(table_CP1252)

CP1252 charset, see http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT

View Source
var CP866 = New(table_CP866)

CP866 charset, see http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/CP866.TXT

View Source
var KOI8_R = New(table_KOI8_R)

KOI8-R charset, see http://www.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT

Functions

This section is empty.

Types

type Charset

type Charset struct {
	// Character ('?' by default) for replacing invalid or
	// undefined in this charset UTF-8 runes.
	ErrorChar byte
	// contains filtered or unexported fields
}

Charset is an object represented a single-byte character set.

func New

func New(table [256]rune) *Charset

New function created a new Charset from given symbol table.

func (*Charset) Decode

func (c *Charset) Decode(bytes []byte) string

Decode decodes bytes to UFT-8 string according with charset

func (*Charset) Decoder

func (c *Charset) Decoder(r io.Reader) io.Reader

Decoder returns an io.Reader that reads charset-encoded data from the underlying io.Reader and converts them to UTF-8.

func (*Charset) Encode

func (c *Charset) Encode(s string) []byte

Encode encodes UFT-8 string to bytes according with charset

func (*Charset) Encoder

func (c *Charset) Encoder(w io.Writer) io.Writer

Encoder returns an io.Writer that takes UTF-8 data, converts them to charset and transmits to the underlying io.Writer.

UTF-8 data must be aligned to runes boundaries!

Jump to

Keyboard shortcuts

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