wcu

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CharsetFromContentType

func CharsetFromContentType(contentType string) string

func DecodeBytes

func DecodeBytes(src []byte, chatset string) ([]byte, error)

DecodeBytes Converts the bytes with specified charset to UTF-8.

func DetectAndDecodeBytes

func DetectAndDecodeBytes(src []byte, html ...bool) ([]byte, error)

DecodeBytes Detect the chatset of the bytes and convert it to UTF-8.

func DetectAndOpenFile

func DetectAndOpenFile(filename string, charsets ...string) (io.ReadCloser, string, error)

DetectAndOpenFile use specified charsets to open file, return (transformed reader, encoding name, error). if charsets is not specified, or specified charset is unsupported, detect the charset of the file, and open a transformed ReadCloser. return (nil, "", err) if failed to open file, charset is unsupported or read error occurred.

func DetectAndReadFile

func DetectAndReadFile(filename string, charsets ...string) ([]byte, string, error)

DetectAndReadFile detect the charset of the file, and open a transformed ReadCloser

func DetectAndTransform

func DetectAndTransform(r io.Reader, html ...bool) (io.Reader, string, error)

DetectAndTransform Detect the chatset from the reader and transform the reader with the detected xcharset.

func DetectCharsetBytes

func DetectCharsetBytes(data []byte, html ...bool) (string, error)

func DetectCharsetFile

func DetectCharsetFile(filename string) (string, error)

DetectCharsetFile detect file's charset

func DetectCharsetReader

func DetectCharsetReader(r io.Reader, html ...bool) (io.Reader, string, error)

func IsHTMLFile

func IsHTMLFile(filename string) bool

func OpenFile

func OpenFile(filename string, charset string) (io.ReadCloser, error)

OpenFile use specified charset to open file and return a transformed ReadCloser. return (nil, error) if failed to open file or charset is unsupported

func ReadFile

func ReadFile(filename string, charset string) ([]byte, error)

ReadFile use specified charset to read file. return error if failed to open/read file or charset is unsupported

func Transform

func Transform(r io.Reader, charset string) (io.Reader, string, error)

Transform Transform the (transformed reader, encoding name, errorr) with the specified charset.

Types

This section is empty.

Jump to

Keyboard shortcuts

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