Back to godoc.org

Package charset

v1.12.4
Latest Go to latest

The latest major version is .

Published: Sep 3, 2020 | License: MIT | Module: code.gitea.io/gitea

Index

Variables

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

UTF8BOM is the utf-8 byte-order marker

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

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier