Hacker News new | ask | show | jobs
by gtrubetskoy 3384 days ago
In Go:

  func main() {
      shit := "\U0001f4a9"
      fmt.Printf("len of %s is %d\n", shit, utf8.RuneCountInString(shit))
  }
$ len of � is 1

Though I can't say that this is all that intuitive either...

1 comments

Codepoints still aren't the same as characters.

Consider the examples given about combining emoji; Consider two runes that make one character: e and ◌́