package main import ( "fmt" "unicode/utf8" ) func main() { s := "héllo" // len is bytes; RuneCountInString is characters fmt.Println(len(s), utf8.RuneCountInString(s)) }
count runes vs bytes