我的文章

go-iconv: libiconv for go

FoldUnfold Table of Contents Summary Install Example Convert string Output to io.Writer Input from io.Reader Summary go-iconv is a libiconv wrapper for go. libiconv Convert string to requested character encoding. go-iconv project's homepage is: https://github.com/xushiwei/go-iconv Install git clone git://github.com/xushiwei/go-iconv.git cd go-iconv make install Example Convert string import ( fmt xushiwei.com/iconv ) func main() { cd, err := iconv.Open( gbk , utf-8 ) if err != nil { fmt.Println( iconv.Open failed! ) return } defer cd.Close() gbk := cd.ConvString( 你好,世界! ) fmt.Println(gbk) } Output to io.Writer import ( fmt xushiwei.com/iconv ) func main() { cd, err := iconv.Open( gbk , utf-8 ) ...

Add a New Comment
or Sign in as Wikidot user
(will not be published)
- +

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License