charset

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	F = 0 /* character never appears in text */
	T = 1 /* character appears in plain ASCII text */
	I = 2 /* character appears in ISO-8859 text */
	X = 3 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */
)

Variables

View Source
var (
	DefaultDetector = chardet.NewTextDetector()
)

Functions

func FromBOM

func FromBOM(content []byte) string

FromBOM returns the charset declared in the BOM of content.

func FromHTML

func FromHTML(content []byte) string

FromHTML returns the charset of an HTML document. It first looks if a BOM is present and if so uses it to determine the charset. If no BOM is present, it relies on the meta tag <meta charset="UTF-8"> and falls back on the plain text content.

func FromPlain

func FromPlain(content []byte) string

FromPlain returns the charset of a plain text. It relies on BOM presence and it falls back on checking each byte in content.

func FromXML

func FromXML(content []byte) string

FromXML returns the charset of an XML document. It relies on the XML header <?xml version="1.0" encoding="UTF-8"?> and falls back on the plain text content.

Types

This section is empty.

Jump to

Keyboard shortcuts

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