guess

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encoding

func Encoding(txt io.Reader) ([]string, error)

Encoding detects guesses of character encoding name from byte stream

Example
package main

import (
	"fmt"
	"strings"

	"github.com/goark/gnkf/guess"
)

func main() {
	elist, err := guess.Encoding(strings.NewReader("こんにちは,世界!\n私の名前は Spiegel です。"))
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(strings.Join(elist, ","))
}
Output:

UTF-8,windows-1252,windows-1253,Shift_JIS,windows-1255

func EncodingBytes

func EncodingBytes(b []byte) ([]string, error)

EncodingBytes detects guesses of character encoding name from byte array

Example
package main

import (
	"fmt"
	"strings"

	"github.com/goark/gnkf/guess"
)

func main() {
	elist, err := guess.EncodingBytes([]byte("こんにちは,世界!\n私の名前は Spiegel です。"))
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(strings.Join(elist, ","))
}
Output:

UTF-8,windows-1252,windows-1253,Shift_JIS,windows-1255

Types

This section is empty.

Jump to

Keyboard shortcuts

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