Exemple #1
0
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
}
Exemple #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)
}