charset

package
v1.1.0-alpha.1....-d49ca16 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2015 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package charset provides common text encodings for HTML documents.

The mapping from encoding labels to encodings is defined at http://encoding.spec.whatwg.org.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineEncoding

func DetermineEncoding(content []byte, contentType string) (e encoding.Encoding, name string, certain bool)

DetermineEncoding determines the encoding of an HTML document by examining up to the first 1024 bytes of content and the declared Content-Type.

See http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#determining-the-character-encoding

func Lookup

func Lookup(label string) (e encoding.Encoding, name string)

Lookup returns the encoding with the specified label, and its canonical name. It returns nil and the empty string if label is not one of the standard encodings for HTML. Matching is case-insensitive and ignores leading and trailing whitespace.

func NewReader

func NewReader(r io.Reader, contentType string) (io.Reader, error)

NewReader returns an io.Reader that converts the content of r to UTF-8. It calls DetermineEncoding to find out what r's encoding is.

Types

This section is empty.

Jump to

Keyboard shortcuts

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