2 ms·
After reading [0], I was left with the question: why not just have a utf-8 string type in addition to a byte string type? Also, as a nit, I don't think iso-885
by jeff-davis 6y ago
After reading [0], I was left with the question: why not just have a utf-8 string type in addition to a byte string type?
Also, as a nit, I don't think iso-8859-1 is ASCII.
- jd3 6y ago> why not just have a utf-8 string type in addition to a byte string type? I'm not a go expert, but my understanding is that go "strings" are really all just a series of bytes and it's the standard library functions which treat string operations as UTF-8 encoded by default. I think this reddit post[0] explains it nicely. I suppose the simplicity of "just work with the bytes and apply encoding when necessary" follows go's simplicity and composability/interface patterns well. > Also, as a nit, I don't think iso-8859-1 is ASCII. We're splitting hairs here, but ISO-8859-1 is the eight-bit extension to 7-bit ASCII, no? It includes the standard 128 ASCII characters + up to an additional 128 characters (191 in total for ISO-8859-1 Latin-1 Western European, iirc). [0]: https://old.reddit.com/r/golang/comments/a5v3fn/are_strings_utf8_by_default/ebprjpk/ https://old.reddit.com/r/golang/comments/a5v3fn/are_strings_...