modulepackage
0.0.0-20180208002826-3358181d7394
Repository: https://github.com/axgle/mahonia.git
Documentation: pkg.go.dev
# README
mahonia
character-set conversion library implemented in Go.
Mahonia is a character-set conversion library implemented in Go. All data is compiled into the executable; it doesn't need any external data files.
based on http://code.google.com/p/mahonia/
install
go get github.com/axgle/mahonia
example
package main
import "fmt"
import "github.com/axgle/mahonia"
func main(){
enc:=mahonia.NewEncoder("gbk")
//converts a string from UTF-8 to gbk encoding.
fmt.Println(enc.ConvertString("hello,世界"))
}
donate
# Packages
No description provided by the author
# Functions
EntityDecoder returns a Decoder that decodes HTML character entities.
FallbackDecoder combines a series of Decoders into one.
GetCharset fetches a charset by name.
NewDecoder returns a Decoder to decode the named charset.
NewEncoder returns an Encoder to encode the named charset.
RegisterCharset adds a charset to the charsetMap.
# Constants
INVALID_CHAR means that the source contained invalid bytes, or that the character could not be represented in the destination encoding.
NO_ROOM means there were not enough input bytes to form a complete character, or there was not enough room in the output buffer to write a complete character.
STATE_ONLY means that bytes were read or written indicating a state transition, but no actual character was processed.
SUCCESS means that the character was converted with no problems.
# Structs
A Charset represents a character set that can be converted, and contains functions to create Converters to encode and decode strings in that character set.
A MBCSTable holds the data to convert to and from Unicode.
Reader implements character-set decoding for an io.Reader object.
Writer implements character-set encoding for an io.Writer object.