4 ms·
No, read the article more carefully. A Go string's internal representation is a sequence of bytes. There's nothing UTF-8 about it.
by dsymonds 13y ago
No, read the article more carefully. A Go string's internal representation is a sequence of bytes. There's nothing UTF-8 about it.
- skybrian 13y agoI understood the article just fine. It's not wrong to say that in Go, text (called strings in other languages) is nearly always represented in UTF8 format and is commonly stored in variables of type string, or sometimes []byte. Perhaps I should have left out the word "internal" since it's exposed.
- dsymonds 13y agoYes, "internal representation" has a specific meaning. If you had said "standard representation" or something then I would have agreed with you.
- dchest 13y agoYes, there is: range on a string works on runes by decoding UTF-8.
- dsymonds 13y agoThat has nothing to do with "a string's internal representation". That is just how a range loop is defined/implemented.