Documentation
¶
Index ¶
Constants ¶
View Source
const ( CharsetUTF8 = "utf-8" CharsetUTF16 = "utf-16" CharsetUTF16BE = "utf-16be" CharsetUTF16LE = "utf-16le" CharsetISO8859 = "iso-8859-1" )
Variables ¶
View Source
var ( UTF16BEBOM = []byte{0xFE, 0xFF} UTF16LEBOM = []byte{0xFF, 0xFE} )
Functions ¶
func DetectEncoding ¶
DetectEncoding attempts to determine the encoding of data. It first checks the Content-Type header, then falls back to examining the data. If no encoding can be determined, it returns UTF-8 as the default.
func GetEncodingFromCharset ¶
GetEncodingFromCharset returns the encoding for a given charset name. Returns nil if the charset is unknown.
func GetEncodingFromContentType ¶
GetEncodingFromContentType extracts and returns the encoding from a Content-Type header. Returns nil if no charset is specified or the charset is unknown.
func HasUTF16BOM ¶
HasUTF16BOM returns true if the data begins with a UTF-16 byte order mark.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.