Using range on a string iterates over runes, not bytes:
s := "Go日本"
for i, r := range s {
fmt.Printf("%d: %c\n", i, r)
}
// 0: G
// 1: o
// 2: 日
// 5: 本
Notice the index jumps from to . That's because 日 takes bytes. The range keyword handles multi-byte characters correctly, giving you the starting index and the rune value.