|
|
|
|
|
by chimeracoder
3211 days ago
|
|
> But then why do strings-are-UTF8 languages like Go To clarify: strings in Go are not necessarily UTF-8. String literals will be, because the source code is defined to be UTF-8, but strings values in Go can contain any sequence of bytes: https://blog.golang.org/strings Note that this prints 2, because the character contains two bytes in UTF-8, even though the two bytes correspond to one codepoint: https://play.golang.org/p/BqGzW1O2WX Go also has the concept of a rune, which is separate from a byte and a string, and makes this easier when you're working with raw string encodings. |
|