title: Why is it necessary to mark continuation bytes in UTF-8?
body: <p>I've recently been reading up on the UTF-8 variable-width encoding, and I found it strange that UTF-8 specifies the first two bits of every continuation byte to be 10.</p>
  
  <pre><code> Range           |  Encoding
  -----------------+-----------------
       0 - 7f      |  0xxxxxx
      80 - 7ff     |  110xxxx 10xxxxxx
     800 - ffff    |  1110xxx 10xxxxxx 10xxxxxx
   10000 - 10ffff  |  11110xx 10xxxxxx 10xxxxxx 10xxxxxx
  </code></pre>
  
  <p>I was playing around with other possible variable width encodings, and found that by using the following scheme, at most 3 bytes are necessary to store all of Unicode. If the first bit is a 1, then the character is encoded in at least one more byte (read until the first bit is a 0).</p>
  
  <pre><code> Range           |  Encoding
  -----------------+-----------------
       0 - 7f      |  0xxxxxx
      80 - 407f    |  1xxxxxx 0xxxxxxx
    4080 - 20407f  |  1xxxxxx 1xxxxxxx 0xxxxxxx
  </code></pre>
  
  <p>Are the continuation bits in UTF-8 really that important? The second encoding seems much more efficient.</p>