charset

package
v1.13.5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2021 License: MIT Imports: 9 Imported by: 5

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