示例#1
0
文件: twty.go 项目: anschelsc/twty
func convert_utf8(s string) string {
	ic, err := iconv.Open("char", "UTF-8")
	if err != nil {
		return s
	}
	defer ic.Close()
	ret, _ := ic.Conv(s)
	return ret
}
示例#2
0
func main() {
	tocode := "SJIS"
	fromcode := "UTF-8"

	str := "これは漢字です。"
	//fmt.Printf("%s\n", str);

	cd := iconv.Open(tocode, fromcode)

	str = iconv.Iconv(cd, str)
	fmt.Printf("str='%s'\n", str)

	iconv.Close(cd)
}