Your Unicode experiences?

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
Recently, I've been having some fun with Unicode. You can do some really cool and weird stuff with it. However, it strikes me that although by its nature, it's always going to be something complex, it didn't have to be this complex.

So I was wondering how others encountered Unicode and then what happened. :cool:

Also, are there good reasons to not use Unicode in the 2020s?

The big issue is that it breaks all the assumptions that are made by fixed width character display devices. Try to imagine Unicode with a terminal emulator at 2400 bps or some such, where you can actually follow the text coming in. You would see characters change as additional characters come in that combine with the previous one.

Y̼̅̇̆̊ike᷏͛s⃣! (These are all regular letters followed by combining diacritical marks and an enclosing keycap. Those can be even cooler for * # and digits: 1⃣ 2⃣︎ 3⃣️.)
 

rain shadow

Ars Tribunus Angusticlavius
6,687
Subscriptor++
I wrote an ISO-8859-1 to UTF-8 (and back) translator in support of one of our product's API layers. Obviously it only worked for Latin-1 characters and some very limited diacritics, but still it was kind of fun and it made our customers happy. But there is just a galactic-scale amount of code and devices that assume fixed-column-width display of 7 or 8 bit characters. This all has to age out and that could take 50 years.

I've come to view unicode as a trojan horse that solves glyph representation to the point where it simply becomes dreadfully obvious that your software isn't really internationalized at all. You can type in stuff in Kanji or Thai or emoji, but your app's documentation, help files, prompts, and error messages are still English. Forms backed by code that tries to verify user input often choke on names or data that are entered in non-latin characters, often not even accepting diacritics.

C/C++'s limited support for internationalized parsing of dates, times, monetary amounts, etc is kind of nifty at first, but it's app-wide, so anyone who writes a library or plug-in can't use it unless the surrounding app has already enabled it, and even then if you have multiple threads handling data from different countries you're boned.
 

rain shadow

Ars Tribunus Angusticlavius
6,687
Subscriptor++
Oh, and a turbo pox on all the DBA's who just set the character encoding metadata of their entire database to UTF16LE without actually looking deeper at the meaning of each column, where the data comes from, how it's used, and what collation makes sense for it. 2nd level pox for when they import or export data and it ends up with ’ garbage in it because the encoding metadata wasn't preserved.

https://www.joelonsoftware.com/2003/10/ ... o-excuses/
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
I only have to deal with French, English and very rarely Spanish.
Hm, that doesn't isolate you from all Unicode complexities...

Code:
#!/usr/bin/php
<?
$cafe1 = "café";
$cafe2 = "café";
if ($cafe1 == $cafe2)
  echo "$cafe1 == $cafe2\n";
else
  echo "$cafe1 != $cafe2\n";

$ ./cafe.php 
café != café

(Ok this example doesn't survive the forum post. What I did here was use U+E9 (LATIN SMALL LETTER E WITH ACUTE) for $cafe1 and e + U+301 (COMBINING ACUTE ACCENT) for $cafe2. But on the web it's common to normalize to the combined single character form where possible.)

One of the big issues for programmers is that with Unicode, you can no longer have a C-style string == array of characters, as there's all kinds of ways that Unicode codepoints combine into a single on-screen character.

I would go bonkers if I had to deal with Asian languages or RTL.
Agree, but I think the biggest hurdle there is not being familiar with those things in the first place, not that Unicode adds so much additional complexity.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,362
Subscriptor++
My take: all strings should be in UTF-8 (though, internally inside a program, UTF-16 or UTF-32 is fine). Prove me wrong. Also, all string functions need to be UTF aware. If I ask for a character count, I should get a correct answer on a string that includes characters from any of the extended planes, and it should handle combining marks correctly.

Oh, and as for the "it didn't have to be this complex": yes, it did very much have to be that complex. After all, if your goal is to correctly encode every written language everywhere, well, you quickly learn that many of them have weird rules. For instance, in japanese, often kanji need to have rubi. Which means that a character needs smaller descriptory characters next to it such as. All these various different weird rules means that your encoding needs to be able to deal with weird rules.

Sidenote: chrome has this really annoying spell checking bug with the enhanced spell check where, if you have something from the higher planes, like say an emoji in a textbox input, and then misspell a word after it, the highlight for the misspelling gets put in the wrong place. Drives me mad. By now everyone should understand unicode well enough for that not to happen. 😡


Finally: why does your post have tofu? Is that intentional, or is something garbling the unicode?
 

Lt_Storm

Ars Tribunus Angusticlavius
21,362
Subscriptor++
I only have to deal with French, English and very rarely Spanish. I would go bonkers if I had to deal with Asian languages or RTL.

This is absolutely the wrong way to think about Unicode. You are only dealing with strings, so, any string that someone throws at you needs to be handled correctly. After all, you never know when one of your French business partners is going to do business with someone in Japan. That means that it needs to handle emoji and asian languages. The good news is that this is easy: you just use UTF-8, unicode aware functions, and run a few test cases with unicode to ensure you got the basics right and don't see any tofu.

Sidenote: emoji are a pretty good starting point for testing your code. After all, they are mostly from the 32 bit planes and include things like combining characters. Does your system turn emoji into tofu or do emoji cause character counts to go wrong? If so, then you have a bug you need to fix.


Also, keep a list of buggy unicode strings to test future projects with.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
My take: all strings should be in UTF-8 (though, internally inside a program, UTF-16 or UTF-32 is fine). Prove me wrong. Also, all string functions need to be UTF aware. If I ask for a character count, I should get a correct answer on a string that includes characters from any of the extended planes, and it should handle combining marks correctly.
Right. But what is a good way to do that? Javascript internally uses UTF-16 but doesn't help you with the extended planes (which you can handle yourself if you have to) or combing characters, and those you can't reasonably handle yourself. PHP has separate multibyte string functions, but I couldn't figure out something as obvious as converting from UTF-8 to a Unicode code point.

Oh, and as for the "it didn't have to be this complex": yes, it did very much have to be that complex. After all, if your goal is to correctly encode every written language everywhere, well, you quickly learn that many of them have weird rules.
Yes, all that weird stuff needs to be in there. But just look over the character map. Basically they concatenated the ISO 8859 latin code pages, then a bunch of combining characters, greek, cyrillic, a handful of cyrillic combining characters, then quickly hebrew and arabic and stuff most of us have never heard of. Then after a while some more "normal" characters such as punctuation, but that includes six or so different width spaces. I could go on.

What they should have done is group all the characters from languages that don't require special widths and combining into one big range and also have all the combining stuff together rather than spread out all over the place. This way, it would be possible to have an 80% solution without needing to incorporate the entire Unicode character database in your code.

The way things are now, it's basically all or nothing. Now you could say "it has to be all anyway", but is that workable? Are there even any non-fixed width command line interfaces out there? Requiring a command line environment to support all of Unicode on principle when that's obviously extremely difficult is not the best approach, in my opinion.

Also, why 2^20 + 2^16 characters, not just 2^20? It's that kind of stuff that just makes life more difficult than it needs to be.

Finally: why does your post have tofu? Is that intentional, or is something garbling the unicode?
I didn't know "tofu" (except for the unpleasant stuff my mother used to cook), but that means the thing you see when the system can't display a certain Unicode code point.

What I used was U+20E3 (combining enclosing keycap) and U+FE0E (VS15, yes, E = 15...) and U+FE0F (VS16), the variation selectors. 1 + U+20E3 + U+FE0F displays the 1 on what looks like a button in the original iPhone style. But Windows doesn't seem to support those, so you see squares.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,362
Subscriptor++
My take: all strings should be in UTF-8 (though, internally inside a program, UTF-16 or UTF-32 is fine). Prove me wrong. Also, all string functions need to be UTF aware. If I ask for a character count, I should get a correct answer on a string that includes characters from any of the extended planes, and it should handle combining marks correctly.
Right. But what is a good way to do that? Javascript internally uses UTF-16 but doesn't help you with the extended planes (which you can handle yourself if you have to) or combing characters, and those you can't reasonably handle yourself. PHP has separate multibyte string functions, but I couldn't figure out something as obvious as converting from UTF-8 to a Unicode code point.

Internally, your language encodes strings the way it does. To process things like string length, you need to know if you are talking about the length in memory, glyphs, code points, or pixels and then use the appropriate function for what you want to know. All of which are implemented by libraries. Similarly for getting things like charAt.

Oh, and as for the "it didn't have to be this complex": yes, it did very much have to be that complex. After all, if your goal is to correctly encode every written language everywhere, well, you quickly learn that many of them have weird rules.
Yes, all that weird stuff needs to be in there. But just look over the character map. Basically they concatenated the ISO 8859 latin code pages, then a bunch of combining characters, greek, cyrillic, a handful of cyrillic combining characters, then quickly hebrew and arabic and stuff most of us have never heard of. Then after a while some more "normal" characters such as punctuation, but that includes six or so different width spaces. I could go on.

What they should have done is group all the characters from languages that don't require special widths and combining into one big range and also have all the combining stuff together rather than spread out all over the place. This way, it would be possible to have an 80% solution without needing to incorporate the entire Unicode character database in your code.

First, ASCII characters typically require different widths. After all an n has a different width than does m, so Latin language characters fail to meet the "doesn't require special widths" thing. This is basic typography / font / typesetting theory. Moreover, there is no such thing as an 80% solution. If you don't handle kanji, then, as far as someone from Japan is concerned, you have a 0% solution. Honestly, this is a huge problem as it divides the world into computing haves and computing have-nots.

The way things are now, it's basically all or nothing. Now you could say "it has to be all anyway", but is that workable? Are there even any non-fixed width command line interfaces out there? Requiring a command line environment to support all of Unicode on principle when that's obviously extremely difficult is not the best approach, in my opinion.

It isn't like unicode support is something unheard of for a command line interface. Windows Terminal supports Unicode reasonably, so does Hyper (on both Windows and Linux), and, as I recall, Konsole on Linux. The honest truth is that you will encounter code written by people who come from various places, and having a terminal which can't print that is a *huge* accessibility problem. Having reasonable unicode support in terminals is a reasonable minimum requirement. (Fortunately, it is also reasonably possible).

Also, why 2^20 + 2^16 characters, not just 2^20? It's that kind of stuff that just makes life more difficult than it needs to be.

Because of encoding. Basically, in order to allow for compressed encodings like UTF8, some characters have to be unusable this, combined with when fools thought that 2^16 was all anybody would ever need results in a large number of unusable code points.

Finally: why does your post have tofu? Is that intentional, or is something garbling the unicode?
I didn't know "tofu" (except for the unpleasant stuff my mother used to cook), but that means the thing you see when the system can't display a certain Unicode code point.

What I used was U+20E3 (combining enclosing keycap) and U+FE0E (VS15, yes, E = 15...) and U+FE0F (VS16), the variation selectors. 1 + U+20E3 + U+FE0F displays the 1 on what looks like a button in the original iPhone style. But Windows doesn't seem to support those, so you see squares.

I know why tofu happens. And yes, it seems that windows isn't supporting that right now.... In spite of some serious effort spent to eradicate tofu on my part. *gurrr*.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
Internally, your language encodes strings the way it does. To process things like string length, you need to know if you are talking about the length in memory, glyphs, code points, or pixels
If only life were that simple!

Almost all the programming languages that we use are from before the current state of Unicode. Most still assume 1 char = 1 byte. You can't redefine that, because then all kinds of existing code breaks. Some assume 1 char = 16 bits (javascript). In a way, that's worse because it's not immediately obvious why that doesn't work, while 8-bit characters obviously don't work anymore, at least for us in euro-land. (€ = U+ 20AC.)

I made this accent thingy in javascript (explaining text to be added later), and I had big issues with some unicode stuff taking up way too much space on the screen, but apparently javascript can't provide you any information about what's happening at the glyph level. So eventually I just looked at the table cell size in pixels and then adjusted the content if that cell was getting too big...

Interestingly, with swift you do get individual printable characters/glyphs out of an array-indexable string. That of course means a character is (extremely) variable length, but hey, what can you do.

What they should have done is group all the characters from languages that don't require special widths and combining into one big range and also have all the combining stuff together rather than spread out all over the place. This way, it would be possible to have an 80% solution without needing to incorporate the entire Unicode character database in your code.
First, ASCII characters typically require different widths.
They don't require it. It just looks nicer. BTW, I gather chinese/japanese/korean (han) characters are all the same size, twice a monospace latin character.

Moreover, there is no such thing as an 80% solution. If you don't handle kanji, then, as far as someone from Japan is concerned, you have a 0% solution.
Right. I just don't see a workable path from a terminal environment with fixed width 1-byte characters to a terminal environment that supports all of unicode without a few stops along the way. I mean, how long are your sprints? :p

I know why tofu happens. And yes, it seems that windows isn't supporting that right now.... In spite of some serious effort spent to eradicate tofu on my part. *gurrr*.
This is a good example of the lack of unicode's forward compatibility. With combining characters, especially the non-diacritic ones, if they're not supported the least problematic way to handle them is to simply ignore them. So you're not going to see that round rect around that 1. You still see the 1. But because you need to be current with your unicode support to even know that's a combining mark, if you're not current the only thing you know is "character I don't support" and you draw a rectangle. Still better than a big fat �, though.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,362
Subscriptor++
Internally, your language encodes strings the way it does. To process things like string length, you need to know if you are talking about the length in memory, glyphs, code points, or pixels
If only life were that simple!

Almost all the programming languages that we use are from before the current state of Unicode. Most still assume 1 char = 1 byte. You can't redefine that, because then all kinds of existing code breaks. Some assume 1 char = 16 bits (javascript). In a way, that's worse because it's not immediately obvious why that doesn't work, while 8-bit characters obviously don't work anymore, at least for us in euro-land. (€ = U+ 20AC.)

I made this accent thingy in javascript (explaining text to be added later), and I had big issues with some unicode stuff taking up way too much space on the screen, but apparently javascript can't provide you any information about what's happening at the glyph level. So eventually I just looked at the table cell size in pixels and then adjusted the content if that cell was getting too big...

For the most part, this has to do with using the correct set of functions. It's a bit like how C has printf and sprintf, and you are never supposed to use the former. A language doesn't have to change how it represents strings to be unicode aware (though that would be a nice thing, at least, for future programmers), instead, for many of them use use a unicode aware library.

I the case of Javascript, it is unicode aware post EcmaScript 2015. Though, again, you have to be aware of which library functions you are using. For instance, with javascript regular expressions, you have to tag them with a u to get unicode aware behavior. The spread operator on a string is also unicode aware. Alternately, use the punycode library. Though those don't help much with combining characters.

As for them, well, honestly, the only way to know how wide a string is is to render it. In JavaScript that means either using Canvas.measureText or putting it in a div.

Interestingly, with swift you do get individual printable characters/glyphs out of an array-indexable string. That of course means a character is (extremely) variable length, but hey, what can you do.

Use a byte aware function if you want to learn how much space it takes up.

What they should have done is group all the characters from languages that don't require special widths and combining into one big range and also have all the combining stuff together rather than spread out all over the place. This way, it would be possible to have an 80% solution without needing to incorporate the entire Unicode character database in your code.
First, ASCII characters typically require different widths.
They don't require it. It just looks nicer. BTW, I gather chinese/japanese/korean (han) characters are all the same size, twice a monospace latin character.

Moreover, there is no such thing as an 80% solution. If you don't handle kanji, then, as far as someone from Japan is concerned, you have a 0% solution.
Right. I just don't see a workable path from a terminal environment with fixed width 1-byte characters to a terminal environment that supports all of unicode without a few stops along the way. I mean, how long are your sprints? :p

Use one where that is already done? I mean, as I mentioned Hyper, Windows Terminal, and Konsole all support glyphs from the astral planes. So it isn't like this is something that is just starting.

I know why tofu happens. And yes, it seems that windows isn't supporting that right now.... In spite of some serious effort spent to eradicate tofu on my part. *gurrr*.
This is a good example of the lack of unicode's forward compatibility. With combining characters, especially the non-diacritic ones, if they're not supported the least problematic way to handle them is to simply ignore them. So you're not going to see that round rect around that 1. You still see the 1. But because you need to be current with your unicode support to even know that's a combining mark, if you're not current the only thing you know is "character I don't support" and you draw a rectangle. Still better than a big fat �, though.

Of course, it's impossible to know how wide a string is (or, for that matter, what the idea of 'character' even means) before the characters in question have been defined. So, such forward compatibility is a lost cause even before you start. I mean, just because our language breaks words down by character doesn't imply every written language must.

As for characters you don't understand, well, we can only render characters that have glyphs in the fonts we are using. If you want to render Klingon, but don't have a font that includes Klingon codepoints and who knows what we will need to encode next.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
I the case of Javascript, it is unicode aware post EcmaScript 2015. Though, again, you have to be aware of which library functions you are using. For instance, with javascript regular expressions, you have to tag them with a u to get unicode aware behavior. The spread operator on a string is also unicode aware. Alternately, use the punycode library. Though those don't help much with combining characters.
Right. With these older languages you have to be very careful about what you can do without breaking unicode compatibility. For instance, you really can't use any string slicing functions unless they're fully Unicode-aware. But for web stuff you're not going to output preformatted text anyway (I hope) so that's not as bad as in a command line environment.

One thing to be extremely careful with though is normalization when doing string compares. (To avoid my earlier café != café example.) Fortunately that's easy enough with javascript.

Of course, it's impossible to know how wide a string is (or, for that matter, what the idea of 'character' even means) before the characters in question have been defined. So, such forward compatibility is a lost cause even before you start. I mean, just because our language breaks words down by character doesn't imply every written language must.
That's one way to approach the situation. The other is: what if I get characters that are new in unicode relative to the unicode implementation I'm currently using? Now what? "Tofu"? That's no fun.

What we want is graceful degradation. So if I don't have é, I still get an e, not a box. Especially as all the obvious stuff was included in unicode a decade or two ago, the approach of quietly ignoring unrecognized stuff will work fairly well.

But for that to work, we need to know the category that an unknown character belongs to even if we don't know anything else about the character. And that's something unicode could have done, rather than sprinkle characters and small ranges of characters with violently different properties throughout the namespace.

Sure, if you have implemented unicode for the ISO 8859 scripts and then suddenly you get arabic, there's no way to handle that in any reasonable way without learning a whole bunch of new stuff. But that's not to say that a limited unicode implementation that can handle the first 592 unicode characters and render those with a monospace font is not an improvement over the codepage madness that came before, even though it falls woefully short of the unicode ambitions.

This is what I would have done with the benefit of hindsight:

Create UTF-11. That's a 16-bit encoding that is the same as UTF-8 for U+80 - U+7FF. For U+0 to U+7F it breaks UTF-8 by also encoding these in UTF-8 form. So now you have a two-byte fixed width encoding that's compatible with UTF-8 if you squint a bit.

Now put the 2000 most common characters that can be displayed in a monospace font there, and anything that requires other spacing or combining or won't fit in that first 2000 above that, with a section for individual special handling characters, one for combining characters and one for fixed width characters. That way, the default behavior for such characters if they are unrecognized can still be reasonable.

Of course keep UTF-8, deprecate UTF-16 as it's the worst of all worlds and keep the code point range to 20 bits.

Of course that would have been useful two decades ago, by now unicode support is mature enough that there's no point in going back to rethink well established things. But please avoid creating even more separate small ranges of specialness, U+people.
 
Breaking or non-breaking? :cool:

They are "potential breaks", they don't force a break, but if a break is desired that's where it can be applied.

I mentioned them because I needed a way to transmit keywords in a data set that had firewall rules preventing said keywords. Inserting the zero-width space into the words solved my issue and displayed the words as expected (no break), but the words no longer matched the keyword list.

It's absolutely stupid, but it worked. Most people are surprised the concept even exists, as the expectation is characters are printable, or take up space. Unicode has every damn exception, which is why it's overly complicated, fascinating and frustrating all at once.
 
After all, you never know when one of your French business partners is going to do business with someone in Japan.
Yeah, that's never going to happen. If we ever need to deal with Japanese characters, it will be because we sign on a Japanese client.

That means that it needs to handle emoji and asian languages. The good news is that this is easy: you just use UTF-8, unicode aware functions, and run a few test cases with unicode to ensure you got the basics right and don't see any tofu.
That said, agreed 100%. However, we're in the unfortunate position of having to catch up to a huge backlog of issues due to historical chronic understaffing of our department, so we don't have time to refactor now. Thankfully, we're increasing headcount so this is something that we can look at in the future.
 

gregatron5

Ars Legatus Legionis
13,010
Subscriptor++
I remember having a discussion a while back, perhaps on this forum, about how Obj-C string collation was faster than Java’s or vice versa. I had to point out that one or the other was by default sorting based on system locale and normalized form. When you used the same setup on the other language they became about even.

Unicode is just like any other developer tool. You have to know it and how to use it. If not, you can get things done, but there’s a good chance you won’t get them right.

To answer the original questions, there is no good reason to not use Unicode now except in perhaps embedded systems.

I first encountered it over 20 years ago when I started delving into XML. I got very familiar with the BOM because almost no common text editors at the time could handle it.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,362
Subscriptor++
After all, you never know when one of your French business partners is going to do business with someone in Japan.
Yeah, that's never going to happen. If we ever need to deal with Japanese characters, it will be because we sign on a Japanese client.

That means that it needs to handle emoji and asian languages. The good news is that this is easy: you just use UTF-8, unicode aware functions, and run a few test cases with unicode to ensure you got the basics right and don't see any tofu.
That said, agreed 100%. However, we're in the unfortunate position of having to catch up to a huge backlog of issues due to historical chronic understaffing of our department, so we don't have time to refactor now. Thankfully, we're increasing headcount so this is something that we can look at in the future.

The simple thing to do now is make a rule that future features will use unicode aware functions and have unicode in their test cases. That way what's new won't need that refactoring and people will learn to use the right functions out of habit. Then as you refactor things, unicode support will spread.
 
D

Deleted member 43669

Guest
On topic with the thread, but off topic with the conversation at hand, I feel obliged to post again:

https://modelviewculture.com/pieces/i-c ... te-my-name

I don't really know if things have evolved since then, but it does irk me that so much effort on Unicode seems to be about emojis, which could really be a separate thing (I know that it's probably convenient in some aspects to dump emojis into Unicode, but...I feel there's gotta be a good argument for keeping them separate).
 
On topic with the thread, but off topic with the conversation at hand, I feel obliged to post again:

https://modelviewculture.com/pieces/i-c ... te-my-name

I don't really know if things have evolved since then, but it does irk me that so much effort on Unicode seems to be about emojis, which could really be a separate thing (I know that it's probably convenient in some aspects to dump emojis into Unicode, but...I feel there's gotta be a good argument for keeping them separate).

Emojis are fun.

But, they are a standardized set of pictographs. Absolutely no reason for them not to be part of Unicode.
(My only issue with them is that we've made it difficult for new ones to be added, iOS and Android should update them dynamically from a server over time so everyone always has access to the latest set.
Software upgrades should not be necessary to achieve it.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
On topic with the thread, but off topic with the conversation at hand, I feel obliged to post again:

https://modelviewculture.com/pieces/i-c ... te-my-name
They are comprised largely of white men
Remind me, there are words for disqualifying people's contributions solely based on their skin color and gender...

I can't speak to the issues with Bengali. The writer says her (his?) name has a character that doesn't exist in unicode and has to use a workaround. That may be "works as intended", as not every grapheme gets its own U+ code point. Or maybe it's really that bad. Too bad only the latin character version of that name appears.

However, unicode bent over backwards to include existing standards and industry practices in its early days. I assume that there was no suitable Bengali standard to include, because if there had been, they'd done that.

Han unification is a big controversy, and I wouldn't presume to be able to judge if that was a reasonable decision. The reason they did this was probably because at that point, they were still assuming 16 bits for unicode.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,362
Subscriptor++
On topic with the thread, but off topic with the conversation at hand, I feel obliged to post again:

https://modelviewculture.com/pieces/i-c ... te-my-name

I don't really know if things have evolved since then, but it does irk me that so much effort on Unicode seems to be about emojis, which could really be a separate thing (I know that it's probably convenient in some aspects to dump emojis into Unicode, but...I feel there's gotta be a good argument for keeping them separate).

Emoji is a trojan horse for Unicode support, especially astral plane characters. After all, most Americans (and therefore most American programmers) don't give one fig about foreign language support. But, emoji are fun. So, if you make emoji part of unicode, then when Americans demand emoji, unicode comes along for the ride. Whereas, if it's a separate thing, then unicode will get less penetration. So, obviously it's beneficial to tie them together.

Also, there is the historic reason that Japanese phone companies included emoji in Japanese character encodings, so, if you wanted to represent Japanese text messages, you needed the initial set of emoji.
 
D

Deleted member 43669

Guest
But, they are a standardized set of pictographs. Absolutely no reason for them not to be part of Unicode.

Things are frequently not a zero-sum game, but if resources are pooled between "making sure everyone can type text in their language" and "the emoji experience", and the latter can take resources from the former, then, yes they should not be a part of Unicode.

(My only issue with them is that we've made it difficult for new ones to be added, iOS and Android should update them dynamically from a server over time so everyone always has access to the latest set.
Software upgrades should not be necessary to achieve it.

I believe that emoji and text representation could benefit from following different lifecycles. Also I believe applications such as Slack implement custom emoji functionality- it sounds like it would be useful for "the emoji" protocol to define extensibility.

Remind me, there are words for disqualifying people's contributions solely based on their skin color and gender...

I do not require that sentence to make the argument I want to make: emoji make take focus from Unicode. Feel free to dismiss that phrase, discuss it in the Soap Box or make an ad hominem argument to the author and the article.

I can't speak to the issues with Bengali. The writer says her (his?) name has a character that doesn't exist in unicode and has to use a workaround. That may be "works as intended", as not every grapheme gets its own U+ code point. Or maybe it's really that bad. Too bad only the latin character version of that name appears.

However, unicode bent over backwards to include existing standards and industry practices in its early days. I assume that there was no suitable Bengali standard to include, because if there had been, they'd done that.

Han unification is a big controversy, and I wouldn't presume to be able to judge if that was a reasonable decision. The reason they did this was probably because at that point, they were still assuming 16 bits for unicode.

This is what I don't know. I lack the knowledge to judge that, and a lot of time has passed since that article has written. I would love to know how far we are in every person in the world being able to write in a computer what they say or write. If we're not making good progress on that (and it's also hard to judge what's good progress), then adding whatever emoji of the day certainly bothers me.

Emoji is a trojan horse for Unicode support, especially astral plane characters. After all, most Americans (and therefore most American programmers) don't give one fig about foreign language support. But, emoji are fun. So, if you make emoji part of unicode, then when Americans demand emoji, unicode comes along for the ride. Whereas, if it's a separate thing, then unicode will get less penetration. So, obviously it's beneficial to tie them together.

Also, there is the historic reason that Japanese phone companies included emoji in Japanese character encodings, so, if you wanted to represent Japanese text messages, you needed the initial set of emoji.

I get the Trojan horse argument, and I agree to an extent with it (although I believe, for instance, Java started supporting Unicode before the emoji craze)- I can see that many general language/framework/etc. implementors might have been influenced by emoji popularity to add support for Unicode to their language/framework/etc.

However, it might cut the other way in some cases (not offsetting the general benefit, IMHO)- if I'm writing a gov't app, I can see someone saying "Unicode support? pffft, that's for emoji".

...

In any case, I don't have the knowledge to evaluate properly the situation- I'm just posting to get more input in the topic (perhaps someone will read this with that knowledge).
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
I just read an article about how MacOS updates now need to be 3 GB and an hour just to update a few kilobytes for... reasons. (Obviously not good ones IMO.)

It would definitely be nice if we could gain new emojis without having to go through all of that. Then again, is waiting a few months for newly defined emojis such a big deal? Although you can't type them, emojis otherwise behalve like all other text, so it seems suboptimal to have different systems for text and emoji. Also, even if an OS maker could update emojis without doing a software update, would they? Someone still needs to draw those pictures on a certain deadline.

About unicode support: around 1990, the OS makers were onboard with unicode. Although I only really speak Dutch and English, I do have some exposure to German, French and Spanish. All those languages work just fine with ISO-8859-1. But what if you translate between Greek and Russian? There was no reasonable way to do that during the 8-bit extended ASCII era. And of course for people to be able to do that, the OSes needed to support it.

I think the idea was to just switch from 8-bit characters to 16-bit ones and call it a day. From what I've read, that's what for instance Windows, Java and Javascript did. I also gather that Apple's HFS+ file system uses 16-bit characters for its names.

However, it turned out we need more than 16 bits and even if you don't use the extra stuff, there's still lots of complexities such as (virtually?) unlimited combining and modifier characters. So unicode has a lot more complexity than just more bits per character.

Fortunately, UTF-8 came along and saved the day so people who wanted to keep their character width 8 bits could live to fight another day. Unfortunately, because of the > 16 bit, UTF-16 replaced UCS-2, so you rewrote all your stuff to handle 16-bit characters but now there's actually characters that are encoded as 2 16-bit values, never mind all the combining stuff.

So unicode breaks a bunch of assumptions:
  1. A code point is 8 bits
  2. A code point is 16 bits
  3. There is a bit you can flip to change case
  4. A glyph is one code point
  5. Given a monospace font, each code point occupies the same screen space
  6. You can split a string at any code point boundary
  7. String compare for two strings that produce the same glyphs == true
As a programmer, you deal with the first six issues by either by simply not attempting to change case or split strings or by using unicode-aware APIs.

The last one is a big one: even if you otherwise avoid the complexity of unicode by just treating text as an opaque sequence of bytes, if you want to be able to do string compares or searches, you need to normalize your strings properly. And there's multiple normalizations appropriate for different operations, so learn them, love them, use them.

For instance, unicode imported (among other things) all the ISO 8859 encodings, which use an 8-bit code point for characters like é. However, you can also make that same glyph with e + combining acute accent. Those are different UTF-8, UTF-16 or UTF-32 sequences. But they are canonically equivalent. So either use NFC, the composed form, or NFD, the decomposed form with a separate combining diacritic. (Just for fun, there's characters that don't decompose as well as many that don't compose. Doesn't matter for normalization, though.)

So for comparing, normalize both strings to either NFC or NFD. Doesn't matter which one. (For transmission/storage, NFC encoding is preferred for the web as it's more compatible with some old stuff. Then again, with NFD, if the accents aren't recognized, you still see the base characters.)

But for searching, you'll want to use the "compatiblity (de)composition" NFKC or NFKD. Here, things that definitely don't look the same, such as "CO₂" == "CO2" will match because they (presumably!) mean the same. However, this doesn't work for "café" == "cafe". So for that, you'd have to further process a string.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,362
Subscriptor++
So unicode breaks a bunch of assumptions:
  1. A code point is 8 bits
  2. A code point is 16 bits
  3. There is a bit you can flip to change case
  4. A glyph is one code point
  5. Given a monospace font, each code point occupies the same screen space
  6. You can split a string at any code point boundary
  7. String compare for two strings that produce the same glyphs == true

A most of those assumptions were never true. Pretty much all of them are things that only someone using Latin script could ever assume.
  1. Not all writing systems have a concept of 'case', in fact, relatively few do. Arabic Script and Kanji definitely don't. Moreover, what the capital of some Latin characters is depends on where you are, so Unicode aware isn't enough to do the job. Is a capital 'i' 'I' or 'İ', depends on what language you speak. You need a locale to capitalize a character.
  2. Not all writing systems have separate glyphs. For instance Hangul writing involves grouping three characters into one 'glyph' representing a syllable. There are, of course, code points for the individual characters and also for the composed glyphs.
  3. Given Hangul, it's pretty obvious that each code point can't always occupy the same screen space in the general case.
  4. Very few writing systems let you split a string at any code-point boundary. In written English, this obviously doesn't work (s
    ee, doesn't work). Hangul has bigger problems with it. Generally string splitting has to be language aware, though spaces can make things a little easier. (Not that every writing system includes spaces...) This gets really hard (unsolvable) in the general case. You might just need a dictionary and still be unable to do a good job of it.

Turns out that international typography is anything but simple, and like the falsehoods programmers believe about names, dates, and such based on our individual experience our inherent assumptions about text based on latin script are broadly false.

Those assumptions weren't broken by unicode, they were *always* false, and only our eurocentric / anglocentric perspective ever let us believe otherwise. Our limited personal experiences are a bad barometer for the broad experiences of the entire human race. And when we assume that our personal experiences are a good barometer for that, we build buggy programs that butcher real people's names, addresses, text, etc. Worse, those bugs end up being racist bugs: they don't affect anyone like us; but, woe be it for someone in Bengal — or just a Mr. Null.

Now, that last one you listed is a bit of a problem. It would be nice if we didn't have to normalize strings to do regular expression matching. But, I wouldn't be shocked to learn that there is some writing system somewhere which makes that impossible.
 

Entegy

Ars Legatus Legionis
18,256
Also, even if an OS maker could update emojis without doing a software update, would they? Someone still needs to draw those pictures on a certain deadline.

New emoji (as a Japanese word, there is no plural) is always a headling feature of a software update because it's an easy, user-facing carrot to get the user to update. Most people do not care about updates, which is why they have to be forced.

One example, I had a colleague who was super excited about the black heart emoji. She was a user who was often a nearly behind in iOS updates because she did not care about many new features or security patches, or how updates changed processes she knew about her iPhone. But for the black heart emoji? She updated the moment I told her the update was available, which also caught her up on security patches. And that's not the only emoji-related updated story I have.

So yeah, any OS maker could update their emoji at any time, but bundling it with an overall software update makes the OS update and the downtime for an update an easy sell. Although, I'm pretty sure Google updates Android emoji independently seeing as most of "Android" is updated through the Play Store anyway due to legendary shitty update situation there. Apple and Microsoft will bundle with OS updates.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
most of those assumptions were never true. Pretty much all of them are things that only someone using Latin script could ever assume.
Guess what: when computers started to support text input and output, that was done using the latin script. And in the 1960s when they made ASCII, nobody was under the illusion that it would allow for anything resembling decent typography. Even for a language with not too many difficult features like English.

And even though proper typography and support for non-latin scripts came to computers after some time, it took additional time for those features to be supported OS-wide rather than in specialized applications. And as we've been finding out in this thread, supporting all of that in your own software is non-trivial, so it does make some sense we don't do it 100% of the time.

For instance, obviously a DBM needs to support unicode in text fields. But IMO it's perfectly fine if the command line interface to that DBM assumes fixed-width characters.
 

Lt_Storm

Ars Tribunus Angusticlavius
21,362
Subscriptor++
most of those assumptions were never true. Pretty much all of them are things that only someone using Latin script could ever assume.
Guess what: when computers started to support text input and output, that was done using the latin script. And in the 1960s when they made ASCII, nobody was under the illusion that it would allow for anything resembling decent typography. Even for a language with not too many difficult features like English.

And even though proper typography and support for non-latin scripts came to computers after some time, it took additional time for those features to be supported OS-wide rather than in specialized applications. And as we've been finding out in this thread, supporting all of that in your own software is non-trivial, so it does make some sense we don't do it 100% of the time.

For instance, obviously a DBM needs to support unicode in text fields. But IMO it's perfectly fine if the command line interface to that DBM assumes fixed-width characters.

Which creates a world of computing haves and computing have nots. It means that, if you want to use a computer, you have to use English. And, it means that, when that DBA needs to look at some value from the database which comes from elsewhere, the computer crashes.

Again, there are real people who our engineering decisions can harm. Real people whose lives we make more difficult when we make unnecessary assumptions about such things. Having software that works for everyone is important.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
I agree that as a matter of principle, it would be better if anyone could do all of their interaction with computers, including managing their databases and writing code, in their own language without undue limitations.

However, that's a difficult principle to realize in practice. I mean, software quality is always a big problem, and now developers have to support usecases they don't understand and thus can't properly test.

Also, it may not always work out as expected. For instance, when you use Excel in another language, the formulas are now in that language, too. That has given me some amount of grief when I tried to figure out how to do something, and then found an English answer, but then I had to spend additional time figuring out how that translates into Dutch. Doesn't help that in Dutch we use a decimal comma so stuff is separated by ; rather than ,.

Then again, universities here have been switching a lot of their teaching to English so now there's tons of Dutch people who can't talk about their own field in their own language. (And there's nothing worse than a bunch of Dutch people speaking English to each other.)
 

Entegy

Ars Legatus Legionis
18,256
CSV file handling in Excel is horrid because of its insistence to use the current language's separator instead of, you know, COMMAS in a COMMA separated value file.

When looking up formulas, I find it best to find the formula on the Office support website in English, then change out the language code in the URL (in my case, change the en-us to fr-fr) to get it in the other language.
 

rain shadow

Ars Tribunus Angusticlavius
6,687
Subscriptor++
TIL there is no codepoint for epsilon ampersand.

Because it isn't a different character.

It's literally a choice of alternate glyph, it has no semantics difference in meaning.
Creating a font with that shape as the ampersand character would be valid.
That's kind of a cop out. "Just make a new font" is not really a practical way to get something on screen that I have been writing since I was a kid. (Not quite as tragic as not supporting the Bengali guy's name though.)

edit:
https://en.wikipedia.org/wiki/Ampersand ... nd_display

There exist codepoints for carryovers from wingdings ampersand variations, so they definitely have accepted alternate glyphs, fwiw.
 
D

Deleted member 43669

Guest
I agree that as a matter of principle, it would be better if anyone could do all of their interaction with computers, including managing their databases and writing code, in their own language without undue limitations.

However, that's a difficult principle to realize in practice. I mean, software quality is always a big problem, and now developers have to support usecases they don't understand and thus can't properly test.

Many problems can be solved at the "framework level". This is the part of the Trojan horse argument I like. Languages having strings as unicode by default can let *some* stuff work automagically. Individual developers will need to figure out how much of those matters they tackle and address- yeah, an intranet app might not need to support RTL languages, etc.

Also, it may not always work out as expected. For instance, when you use Excel in another language, the formulas are now in that language, too. That has given me some amount of grief when I tried to figure out how to do something, and then found an English answer, but then I had to spend additional time figuring out how that translates into Dutch. Doesn't help that in Dutch we use a decimal comma so stuff is separated by ; rather than ,.

Yeah, the Excel thing is... complex. I think a lot of people benefit from formula names being translated, but it certainly causes pain to others. Not a tradeoff I'd like to have to decide on. The CSV thing I think it's just a pain for everyone :p Edit: In Spain we write 1,300.23 as 1.300,23, but I think Excel could handwave it away as "1300.23" is the right number format in a CSV file and move on.
 

iljitsch

Ars Tribunus Angusticlavius
9,637
Subscriptor++
About the CSV thing; i prefer ; to separate fields. Even in English it's much more likely you'll find a comma in a field rather than a semicolon. I import my back account data into a spreadsheet once in a while and i used to produce the ; format with search and replace. They now let me download it that way, much better for me.

About fonts: yes, it sucks that some characters show up in a way you don't like. John Gruber and John Siracusa actually talked about an iOS app that calls itself "weɑther". So with a single story a (like we use in handwriting) rather than the more common two-story a. However, the app maker does this using a trick, that letter isn't really an a, but the "latin small alpha". This also means you won't find "weɑther" by searching for "weather", even with proper normalization.

Using a proper font really is the right solution here. (I specifically looked for a single story a font for my website.) Another possibility is using a glyph variant, but I have no idea how you do that outside of an app that supports it, and how that support works.

Actually unicode might support such variants, it does have a bunch of variant selector characters.