package charset
Import Path
golang.org/x/net/html/charset (on go.dev)
Dependency Relation
imports 11 packages, and imported by one package
Involved Source Files
Package charset provides common text encodings for HTML documents.
The mapping from encoding labels to encodings is defined at
https://encoding.spec.whatwg.org/.
Package-Level Functions (total 4)
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
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. Encoders will use HTML escape sequences for
runes that are not supported by the character set.
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.
NewReaderLabel returns a reader that converts from the specified charset to
UTF-8. It uses Lookup to find the encoding that corresponds to label, and
returns an error if Lookup returns nil. It is suitable for use as
encoding/xml.Decoder's CharsetReader function.
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |