News for hackers. Stuff that matters.
Re:Golang's network stack attempts to parse HTTP headers as ... by jeff-davis on Thursday January 21, 2021 @12:29PM (#25861464)
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.

Re:Golang's network stack attempts to parse HTTP headers as ... by jd3 on Wednesday February 03, 2021 @12:00PM (#26015749)
> 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_...