encode

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineEncodingbyPeek

func DetermineEncodingbyPeek(r *bufio.Reader, contentType string) (encoding.Encoding, error)

自动检测html编码,不会减少缓冲器的内容, 得到编码器后用transform.NewReader解码为utf-8

func GbkToUtf8

func GbkToUtf8(b []byte) []byte

func TransformCoding

func TransformCoding(rd io.Reader, contentType string) (*transform.Reader, error)

转码utf-8,contentType 可以传空值"" DetermineEncoding determines the encoding of an HTML document by examining up to the first 1024 bytes of content and the declared Content-Type.

func UTF8ToGBK

func UTF8ToGBK(b []byte) []byte

GBK is the GBK encoding. It encodes an extension of the GB2312 character set and is also known as Code Page 936.

func UnicodeStrToUtf8

func UnicodeStrToUtf8(str string) string

对Unicode进行转码

func UnicodeToUtf8

func UnicodeToUtf8(str []byte) []byte

对Unicode进行转码

func Utf8ToGB18030

func Utf8ToGB18030(text string) string

GB18030

func Utf8ToGbk

func Utf8ToGbk(text string) string

GBK

Types

This section is empty.

Jump to

Keyboard shortcuts

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