Go handles Unicode and UTF-8 natively by representing all strings as UTF-8 byte sequences and using rune (an alias for int32) to represent individual Unicode code points. Use the unicode package for character classification and the utf8 package for encoding and decoding operations.
package main
import (
"fmt"
"unicode/utf8"
)
func main() {
s := "Hello δΈη"
fmt.Println("String:", s)
fmt.Println("Bytes:", len(s))
fmt.Println("Runes:", utf8.RuneCountInString(s))
for _, r := range s {
fmt.Printf("Rune: %c (U+%04X)\n", r, r)
}
}