r/ProgrammerHumor • • Oct 04 '26

Meme architectureDependentChars

Post image
3.0k Upvotes

372 comments sorted by

View all comments

Show parent comment

35

u/guyblade Oct 05 '26

UTF-16 was a mistake, and it's maddening that several big ecosystems went with it. You get all the complexity of UTF-8, but it also takes up more space in the "average" case since a huge majority of text is in the "ASCII overlap" portion of unicode.

25

u/jmickeyd Oct 05 '26

Windows "went with it" because UCS-2, which UTF-16 is based on, predates UTF-8. When they chose to go with Unicode, it was 16 bits per character.

3

u/Numerlor Oct 05 '26

It was first and was supposed to be what utf 32 is now, didn't really work out but what's done is done

1

u/conundorum Oct 05 '26

Only in hindsight. When it was made, 16-bit character space really was enough for everything that was intended to be part of Unicode, and supporting UCS-2 was actually a major improvement over everyone having to constantly swap code pages if they wanted to support multiple languages simultaneously. Honestly, the biggest reason we realised we were going to need better was because Windows & Java jumped on UCS-2 (and by extension, UTF-16) as soon as they could, letting us see its downsides before it was too entrenched to fix. (And considering how deeply entrenched it was in Windows before they had to figure out how to pivot away, it's really saying something that it could've been worse.)

The true mistake was trying to make it fixed-width in the first place.

1

u/thanatica Oct 06 '26

Meanwhile plsome folks were like "memory is cheap". Well that backfired.