Hacker News new | past | comments | ask | show | jobs | submit login

I agree with you, but I think it proves my point.

I completely agree that it would be best if I could just ask "how wide is this string?", and not worry about code points or grapheme clusters at all. That'd be amazing. But I can't. So, I need to iterate over grapheme clusters, but I can't. So, to do that, I need to iterate over code points, but I can't. So, to get around that, I have to decode code units to code points manually, then build all the way up the aforementioned problems. Each time you encounter these problems. It's a PITA, because Unicode support is so piss poor in so many languages.

Or I'm a user, and the experience is just poor because the coder couldn't be bothered to do it right, most likely because it's so difficult.

To some extent, I'm sure there are libraries (is there a library for terminal output width?), but often, it's coder ignorance that results in them not getting used. There's be more awareness if the API forced you to choose the appropriate type of sequence: you'd be forced to think (and maybe seek a library to avoid thinking). Instead, the default is often wrong.

> On the other hand, when working with strings, what you do often need is the size in bytes

And for this, I'm thankful. Most of the time, it doesn't matter. But when it does, you're in for a world of hurt.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: