basic_charset

package
v1.3.4-rc3 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: AGPL-3.0, MIT Imports: 5 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

This section is empty.

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