Live data from Hacker News

What every software developer must know about Unicode in 2023

tonsky.me

71–80 of 572 posts

Re: What every software developer must know about Unicode in 2023

#71

Earlier quoted context omitted.

Where are the decimal numbers in that image?

It goes 90000..9FFFF then 100000..10FFFF. The latter should have been A0000..AFFFF. So the author is using hex for the last four digits and decimal for the remaining ones.

oops :) fixed, thanks!

Re: What every software developer must know about Unicode in 2023

#72
post #69

> The only modern language that gets it right is Swift: I disagree. What is the "right" things is use-case dependent. For UI it's glyph bases, kinda, more precise some good enough abstraction over render width. For which glyphs are not always good enough but also the best you can get without adding a ton of complexity. But for pretty much every other use-case you want storage byte size. I mean in the UI you care abou…

Swift string type has got many different views, like UTF-8, UTF-16, Unicode Scalar, etc… so if you want to count the bytes or cut over a specific byte you still can.

that's not the issue

defaults matter

as in they should things you can just use by-default without thinking about it

as swift is deeply rooted in UI design having a default of glyphs make sense

and as rust is deeply rooted in unix server and system programming utf-8 bytes make a lot of sense

through the moment your language becomes more general purpose you could argue having a default in any way is wrong and it should have multiple more explicit methods.

Re: What every software developer must know about Unicode in 2023

#73

Earlier quoted context omitted.

The writing systems were already like this when we got them. Unicode's "total mess" mostly just reflects that. Of course it would be convenient for you, the programmer, if the users wanted the software to do whatever was easiest for you, but obviously they want what's easiest for them, not you.

Name one writing system where you really need character composition. Even if there is one, these special cases should be handled outside of Unicode.

you can't not handle devanagari, tamil (or like half the scripts across the Indian subcontinent and oceania) or hangul. even the IPA, used by linguists every day, would be particularly bad to deal with if we couldn't write things like /á̤/, and some languages already don't have the precomposed diacritics for all letters (like ǿ), so the idea of a world with only precomposed letter forms is more of a exponential explosion in the character set

Re: What every software developer must know about Unicode in 2023

#74

> People are not limited to a single locale. For example, I can read and write English (USA), English (UK), German, and Russian. Which locale should I set my computer to? Ideally - the "English-World" locale is supposedly meant for us, cosmopolitans. It's included with Windows 10 and 11. Practically, as "English-World" was not available in the past (and still wasn't available on platforms other than Windows the last…

> Practically, as "English-World" was not available in the past (and still wasn't available on platforms other than Windows the last time I checked), I have always been setting the locale to En-US even though I have never been to America. This leads to a number of annoyances though. E.g. LibreOffice always creates new documents for the Letter paper format and I have to switch it to A4 manually every time. It's even worse on Linux where locales appear to be less easy to customize than in Windows. Windows always offered a handy configuration dialog to granulatly tweak your locale choosing what measures system you prefer, whether your weeks begin on sundays or mondays and even define your preferred date-time format templates fully manually.

There's the English (Denmark) locale for that on some platfoms.

Re: What every software developer must know about Unicode in 2023

#75

> The rest, about 800,000 code points, are not allocated at the moment. They could become characters in the future. Why is Tengwar still not in Uniclde officially? What's the problem with it?

To save other people the google: Tengwar is probably not in unicode because it is a fictional script from a book.

I would wonder how many people are here who have never seen Tengwar. I would bet that's a minuscule minority.

Re: What every software developer must know about Unicode in 2023

#76
post #58

The author seem to hate people which concentration issues and/or various visual sicknesses. That coloration tools shows the moving mouse coursers of other participants even if they aren't needed/wanted is already pretty bad, why bring it to a website?

This seems like good feedback but it could really be phrased more constructively. I doubt the author “hates” any such thing and you know it too. “Didn’t design with such in mind”, sure. You can do better.

yes I should have highlighted that it is satire

through it also wasn't meant to be constructive critique

Re: What every software developer must know about Unicode in 2023

#77

Unicode is a total mess. In a sane system, "extended grapheme clusters" would equal "codepoints" and it wouldn't make a difference for 99% of languages. Now we ended up with grapheme clusters, normalization, decomposition, composition, Zalgo text, etc. But instead of deprecating this nonsense, Unicode doubled down with composed Emojis.

> Unicode doubled down with composed Emojis.

Not just emojis, in general I believe Unicode has just said they're not going to add new pre-composed characters and that using combining characters is the Right Way™ to do things (well, the only way for newer scripts).

One of the downsides of writing down specifications is that they tend to attract people with Very Strong Opinions on the One And Only Right Way and will argue it to no end, and essentially "win" the argument just by sheer verbosity and persistence.

That's certainly what I've seen happen in a few cases, and is what happens on e.g. Wikipedia as well at times.

But yeah, emojis is even worse. Something things can look rather different depending on which invisible variation selector is present. We've got tons and tons of unassigned codepoints and we need to resort to these tricks to save a few of them?

Firefighter is "(man|woman|person) + ZWJ + firetruck". Clever, I guess. Construction worker is "Construction worker (+ ZWJ + (male sign|female sign))?" (absence is gender-neutral). Why are there 2 systems to encode this? Sigh...

All of this is too clever by a mile.

[1]: HN will strip stuff, but try something like:

  echo $'↔\ufe0f ↔\ufe0e'
May not display correctly in terminal, but can xclip it to a browser – screenshot: https://imgur.com/a/iFmBDQk

Re: What every software developer must know about Unicode in 2023

#78
post #32

> Unicode is locale-dependent Well, there is a new fact that I learned and immediately hated. The fuck were authors thinking... I am now firmly convinced people developing unicode hate developers. I suspected it before just due to how messy it was (same character having different encodings ? Really ? Fuck you), but this cements it.

Unicode is not locale-dependent, just mapping from graphemes to (font) glyphs is locale/font dependent.

Re: What every software developer must know about Unicode in 2023

#79

Earlier quoted context omitted.

The writing systems were already like this when we got them. Unicode's "total mess" mostly just reflects that. Of course it would be convenient for you, the programmer, if the users wanted the software to do whatever was easiest for you, but obviously they want what's easiest for them, not you.

Name one writing system where you really need character composition. Even if there is one, these special cases should be handled outside of Unicode.

The intent of Unicode was to have a universal solution for humans. Excluding one case, even if it's remote, would defeat this mission statement.

Re: What every software developer must know about Unicode in 2023

#80

Earlier quoted context omitted.

What sort of practical issues are you running into due to Unicode's codepoint compositionality?

It's unnecessary complexity and a security nightmare. Have you ever tried to implement Unicode normalization? A single bug in your code and malformed text can crash your application or worse.

That's tricky, for sure. My 'workaround' has long been converting codepoints into byte sequences and creating a character dictionary from that. Based on the source corpus, this dictionary can be further expanded/compressed and used for downstream processing.
Post reply on HN