text

package
v0.0.0-...-36219cd Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	GB2312        = 0
	GBK           = 1
	GB18030       = 2
	HZ            = 3
	BIG5          = 4
	CNS11643      = 5
	UTF8          = 6
	UTF8T         = 7
	UTF8S         = 8
	UNICODE       = 9
	UNICODET      = 10
	UNICODES      = 11
	ISO2022CN     = 12
	ISO2022CN_CNS = 13
	ISO2022CN_GB  = 14
	EUC_KR        = 15
	CP949         = 16
	ISO2022KR     = 17
	JOHAB         = 18
	SJIS          = 19
	EUC_JP        = 20
	ISO2022JP     = 21
	ASCII         = 22
	OTHER         = 23
	TOTALTYPES    = 24
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BytesEncodingDetect

type BytesEncodingDetect struct {
	GBFreq    [][]int
	GBKFreq   [][]int
	Big5Freq  [][]int
	Big5PFreq [][]int
	EucTwfreq [][]int
	KRFreq    [][]int
	JPFreq    [][]int
	EncodingDetect
}

func NewBytesEncodingDetect

func NewBytesEncodingDetect() *BytesEncodingDetect

func (*BytesEncodingDetect) DetectBytesEncoding

func (detect *BytesEncodingDetect) DetectBytesEncoding(rawtext []byte) encoding.Encoding

func (*BytesEncodingDetect) DetectEncoding

func (detect *BytesEncodingDetect) DetectEncoding(rawtext []int) int

*

  • Function : detectEncoding Aruguments: byte array Returns : One of the
  • encodings from the EncodingDetect enumeration (GB2312, HZ, BIG5, EUC_TW, ASCII,
  • or OTHER) Description: This function looks at the byte array and assigns
  • it a probability score for each encoding type. The encoding type with the
  • highest probability is returned.

func (*BytesEncodingDetect) DetectFileEncoding

func (detect *BytesEncodingDetect) DetectFileEncoding(file string) (encoding.Encoding, error)

*

  • Function : detectEncoding Aruguments: File Returns : One of the encodings
  • from the EncodingDetect enumeration (GB2312, HZ, BIG5, EUC_TW, ASCII, or OTHER)
  • Description: This function looks at the file and assigns it a probability
  • score for each encoding type. The encoding type with the highest
  • probability is returned.

type EncodingDetect

type EncodingDetect struct {
	// contains filtered or unexported fields
}

func NewEncoding

func NewEncoding() *EncodingDetect

Jump to

Keyboard shortcuts

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