小程序容器助力企业在金融与物联网领域实现高效合规运营,带来的新机遇与挑战如何管理?
478
2022-11-03
enca - 最小的cgo绑定libenca
This is a minimal cgo bindings for libenca.
If you need to detect the language of a string you can use 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:
package mainimport ( "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.
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~