charset

package
v1.14.0-rc7 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UTF8BOM = []byte{'\xef', '\xbb', '\xbf'}

UTF8BOM is the utf-8 byte-order marker

Functions

func DetectEncoding

func DetectEncoding(content []byte) (string, error)

DetectEncoding detect the encoding of content

func RemoveBOMIfPresent

func RemoveBOMIfPresent(content []byte) []byte

RemoveBOMIfPresent removes a UTF-8 BOM from a []byte

func ToUTF8

func ToUTF8(content string) string

ToUTF8 converts content to UTF8 encoding and ignore error

func ToUTF8DropErrors

func ToUTF8DropErrors(content []byte) []byte

ToUTF8DropErrors makes sure the return string is valid utf-8; attempts conversion if possible

func ToUTF8WithErr

func ToUTF8WithErr(content []byte) (string, error)

ToUTF8WithErr converts content to UTF8 encoding

func ToUTF8WithFallback

func ToUTF8WithFallback(content []byte) []byte

ToUTF8WithFallback detects the encoding of content and coverts to UTF-8 if possible

Types

This section is empty.

Jump to

Keyboard shortcuts

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