Max. bytes in a UTF-8 char?


There are a maximum of 4 bytes in a single UTF-8 encoded unicode character.

And this is how the encoding scheme works in a nutshell.

Bits of code point First code point Last code point Bytes in sequence Byte 1 Byte 2 Byte 3 Byte 4
7 U+0000 U+007F 1 0xxxxxxx      
11 U+0080 U+07FF 2 110xxxxx 10xxxxxx    
16 U+0800 U+FFFF 3 1110xxxx 10xxxxxx 10xxxxxx  
21 U+10000 U+1FFFFF 4 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx

Source: Wikipedia (also confusingly showing 6 possible bytes when truly 4 is the maximum)

Wait, I heard there could be 6?

You heard wrong.

Continue reading

Why GPL would have done nothing to prevent Google from closing up Android

I read an interestig article on The Verge the other day entitled ‘Google’s iron grip on Android: Controlling open source by any means necessary’. It basically details how Google is slowly but surely closing up Android, by stopping maintenance and new development on the Open Source versions of most important apps and instead improving only the closed source forks of these apps in the Google Play store.

Locked Android
(Image courtesy of

It is an interesting strategy: Start out by giving something away for free and only once you have gained a strong foothold in the marketplace, start closing it up so you get/keep full control and can start milking your new cash cow.

Turns out that The Verge is doing a series of articles on this subject and I spend quitte some time reading some of them. I also tend to read comments and it was one of the comments that triggered this blog post. Basically the commenter was saying that if Android would have been GPL licensed this strategy of Google would not have been possible:

OK, a Nook can run programs that were coded for an older version of Android, maybe even a recent version. But it cannot be called, nor IS it called “Android.” This is sorta like Linux where you can only use version 2.2. Except that Linux is GPLv2, which would never allow this sort of foolishness.

This is pertinently false!

I hate it when people spread disinformation about topics I care about, such as Open Source. So much so that I created an entire blog just to store the standard message I give people who claim that Open Source software is not necessarily free as in free beer, when in fact it is.

So why would a GPL license here have done nothing to prevent ‘this sort of foolishness’?

Continue reading

Active/Passive 3D Myth Revisited

About a month ago I wrote a post on this blog about what I like to refer to as the Passive 3D myth which states that

Passive 3D systems offer inferior resolution when compared to Active 3D because each eye only gets to see half of the image lines on the screen.

That post has received some good and insightful comments that made me rethink my position… and come to the exact same conclusion that the statement above is indeed a myth.

The comments did give a very good insight into where the source of the confusion lies when discussing this so I decided to revisit this subject with a more detailed explanation of why I think the statement is a myth and why the refresh rate of the television or the frame rate of the source material are largely irrelevant to the discussion of the merit of this statement.

Active glasses (back) shut out each eye in turn, passive glasses (front) filter the light

Continue reading