Documentation ¶
Overview ¶
* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- func DetectTextEncoding(content []byte) (encoding.Encoding, string, error)
- func DetectTextEncodingFromReader(reader io.Reader) (encoding.Encoding, string, error)
- func GetUnsupported(name string) (encoding.Encoding, error)
- func Iconv(reader io.Reader, fromEncoding encoding.Encoding, toEncoding encoding.Encoding) io.Reader
- func IconvBytes(input []byte, fromEncoding encoding.Encoding, toEncoding encoding.Encoding) ([]byte, error)
- func IconvBytesFromLabels(input []byte, fromEncodingLabel string, toEncodingLabel string) (transformedBytes []byte, err error)
- func IconvFromLabels(reader io.Reader, fromEncodingLabel string, toEncodingLabel string) (transformedReader io.Reader, err error)
- func IconvString(input string, fromEncoding encoding.Encoding, toEncoding encoding.Encoding) (string, error)
- func IconvStringFromLabels(input string, fromEncodingLabel string, toEncodingLabel string) (transformedText string, err error)
- func LookupCharset(charsetLabel string) (charsetEnc encoding.Encoding, charsetName string, err error)
- type ICharsetEncodingMapping
Constants ¶
const InvalidUTF8CharacterReplacement = "?"
Variables ¶
This section is empty.
Functions ¶
func DetectTextEncoding ¶
DetectTextEncoding returns best guess of encoding of given content.
func DetectTextEncodingFromReader ¶
DetectTextEncodingFromReader returns best guess of encoding of given reader content. Looks at the first 1024 bytes in the same way as https://pkg.go.dev/golang.org/x/net/html/charset#DetermineEncoding
func GetUnsupported ¶
GetUnsupported gets valid IANA charset encoding we know are not supported by golang but not reported as such.
func Iconv ¶
func Iconv(reader io.Reader, fromEncoding encoding.Encoding, toEncoding encoding.Encoding) io.Reader
Iconv converts from any supported text encodings to any other, through Unicode conversion. Similar to https://www.gnu.org/software/libiconv/ but using pure go as opposed to many go libraries
func IconvBytes ¶
func IconvBytes(input []byte, fromEncoding encoding.Encoding, toEncoding encoding.Encoding) ([]byte, error)
IconvBytes converts bytes from one text encoding charset to another.
func IconvBytesFromLabels ¶
func IconvBytesFromLabels(input []byte, fromEncodingLabel string, toEncodingLabel string) (transformedBytes []byte, err error)
IconvBytesFromLabels is similar to IconvBytes but uses labels.
func IconvFromLabels ¶
func IconvFromLabels(reader io.Reader, fromEncodingLabel string, toEncodingLabel string) (transformedReader io.Reader, err error)
IconvFromLabels is similar to Iconv but uses labels.
func IconvString ¶
func IconvString(input string, fromEncoding encoding.Encoding, toEncoding encoding.Encoding) (string, error)
IconvString converts string from one text encoding charset to another.
Types ¶
type ICharsetEncodingMapping ¶
Directories ¶
Path | Synopsis |
---|---|
* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors.
|
* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. |
Package iconv provides utilities to convert characters into different charsets
|
Package iconv provides utilities to convert characters into different charsets |