title: Getting the actual length of a UTF-8 encoded std::string?
body: <p>my std::string is utf-8 encoded so obviously, str.length() returns the wrong result.</p>
  
  <p>I found this information but I'm not sure how I can use it to do this:</p>
  
  <blockquote>
    <p>The following byte sequences are
    used to represent a character.  The 
    sequence  to  be
           used depends on the UCS code number of the character:</p>
  
  <pre><code>   0x00000000 - 0x0000007F:
         0xxxxxxx
  
     0x00000080 - 0x000007FF:
         110xxxxx 10xxxxxx
  
     0x00000800 - 0x0000FFFF:
         1110xxxx 10xxxxxx 10xxxxxx
  
     0x00010000 - 0x001FFFFF:
         11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
  </code></pre>
  </blockquote>
  
  <p>How can I find the actual length of a UTF-8 encoded std::string? Thanks</p>