4 ms·
Unicode standard has made bad choices over the years. "Because it's valid Unicode" is not a good reason to do anything. It's better to detect errors in strings
by nabla9 6y ago
Unicode standard has made bad choices over the years. "Because it's valid Unicode" is not a good reason to do anything. It's better to detect errors in strings sooner than later.
If you want to carry any valid UTF-8 string, you can as well treat them as binary blobs and solve the issue.
- chriswarbo 6y agoCan I ask what the point of a "string" type would be, if it causes unexpected errors and should be avoided in favour of blobs?
- hamandcheese 6y agoIn the case of Postgres, you need string types if you intend to do any string operations on those strings in the database. As mentioned in the article, you also have no choice if you want to use jsonb.
- Yaggo 6y agoYeah. There's probably all kind of obscure use cases for ASCII, but generally, any text meant to be human readable should be Unicode encoded, whether you call it "string" or "blob".
- nabla9 6y agoNothing. If you accept only workable specific subset of Unicode and validate input, you can get the point back. Using utf-8 encoding for text is almost always the right ting to do, treating it as generic Unicode string is usually wrong. Unicode is as complex as UTF-8 encoding is simple an neat. Joel Spolsky studied Unicode and was so sure that he understood it that he wrote a short intro for programmers without knowing that code points in Unicode don't correspond to "platonic ideal letters" aka user perceived characters. They correspond only in every case he used them (user-perceived character may actually be a sequence of code points).
- Supermancho 6y ago> "Because it's valid Unicode" is not a good reason to do anything. There is the benefit of consistency. This is ostensibly, the issue at hand.