https://github.com/endeveit/enca
Minimal cgo bindings for libenca
https://github.com/endeveit/enca
Last synced: 9 months ago
JSON representation
Minimal cgo bindings for libenca
- Host: GitHub
- URL: https://github.com/endeveit/enca
- Owner: endeveit
- License: mit
- Created: 2014-12-17T04:55:16.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-03-15T07:18:17.000Z (over 9 years ago)
- Last Synced: 2024-07-31T20:52:34.400Z (over 1 year ago)
- Language: Go
- Size: 22.5 KB
- Stars: 16
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-go - enca - Minimal cgo bindings for 🌎 [libenca](cihar.com/software/enca/), which detects character encodings. (Natural Language Processing / Transliteration)
- awesome-go - enca - | - | - | (Text Processing / HTTP Clients)
- awesome-go-cn - enca
- awesome-go-zh - enca
- awesome-go - enca - Minimal cgo bindings for [libenca](https://cihar.com/software/enca/), which detects character encodings. (Natural Language Processing / Transliteration)
- awesome-go-with-stars - enca - Minimal cgo bindings for [libenca](https://cihar.com/software/enca/), which detects character encodings. (Natural Language Processing / Transliteration)
- awesome-go - enca - Minimal cgo bindings for [libenca](http://cihar.com/software/enca/). (<span id="文字处理-text-processing">文字处理 Text Processing</span> / <span id="高级控制台用户界面-advanced-console-uis">高级控制台用户界面 Advanced Console UIs</span>)
- awesome-go - enca - Minimal cgo bindings for [libenca](https://cihar.com/software/enca/), which detects character encodings. (Natural Language Processing / Transliteration)
- fucking-awesome-go - :octocat: enca - Minimal cgo bindings for [libenca](http://cihar.com/software/enca/). :star: 2 :fork_and_knife: 1 (Text Processing / Advanced Console UIs)
- awesome-go - enca - Minimal cgo bindings for [libenca](http://cihar.com/software/enca/). (Text Processing / HTTP Clients)
- awesome-go - enca - Minimal cgo bindings for [libenca](http://cihar.com/software/enca/). - :arrow_down:0 - :star:2 (Text Processing / HTTP Clients)
- awesome-go - enca - Minimal cgo bindings for libenca - ★ 5 (Text Processing)
- awesome-Char - enca - Minimal cgo bindings for [libenca](http://cihar.com/software/enca/). (Text Processing / HTTP Clients)
- awesome-go - enca - Minimal cgo bindings for [libenca](https://cihar.com/software/enca/), which detects character encodings. (Natural Language Processing / Transliteration)
- zero-alloc-awesome-go - enca - Minimal cgo bindings for [libenca](https://cihar.com/software/enca/), which detects character encodings. (Natural Language Processing / Transliteration)
- awesome-go - enca - Minimal cgo bindings for [libenca](https://cihar.com/software/enca/), which detects character encodings. (Natural Language Processing / Transliteration)
- awesome-go-cn - enca
- awesome-go - enca - Minimal cgo bindings for [libenca](http://cihar.com/software/enca/). (Text Processing / Advanced Console UIs)
- awesome-go-extra - enca - 12-17T04:55:16Z|2016-03-15T07:18:17Z| (Bot Building / Transliteration)
- awesome-go-cn - enca
- awesome-go-cn - enca
- awesome-go-plus - enca - Minimal cgo bindings for [libenca](https://cihar.com/software/enca/), which detects character encodings.  (Natural Language Processing / Transliteration)
- awesome-go - enca - Minimal cgo bindings for [libenca](https://cihar.com/software/enca/), which detects character encodings. (Natural Language Processing / Transliteration)
README
# enca [](https://travis-ci.org/endeveit/enca)
This is a minimal cgo bindings for [libenca](http://cihar.com/software/enca/).
If you need to detect the language of a string you can use [guesslanguage](https://github.com/endeveit/guesslanguage) package.
## Supported Go versions
enca is tested against Go 1.0, 1.1, 1.2, 1.3 and tip.
## Usage
Install libenca to your system:
```
$ sudo apt-get install libenca0 libenca-dev
```
Install in your `${GOPATH}` using `go get -u github.com/endeveit/enca`
Then call it:
```go
package main
import (
"fmt"
"github.com/endeveit/enca"
)
func main() {
analyzer, err := enca.New("zh")
if err == nil {
encoding, err := analyzer.FromString("美国各州选民今天开始正式投票。据信,", enca.NAME_STYLE_HUMAN)
defer analyzer.Free()
// Output:
// UTF-8
if err == nil {
fmt.Println(encoding)
}
}
}
```
## Documentation
godoc is available [here](http://godoc.org/github.com/endeveit/enca).