Function to go back 1 UTF-8 character?
<p>I have a function which goes forward 1 utf-8 character and returns the number of bytes it took to get there:</p>

<pre><code>// Moves the iterator to next unicode character in the string,
//returns number of bytes skipped
template&lt;typename _Iterator1, typename _Iterator2&gt;
inline size_t bringToNextUnichar(_Iterator1&amp; it,
    const _Iterator2&amp; last) const {
    if(it == last) return 0;
    unsigned char c;
    size_t res = 1;
    for(++it; last != it; ++it, ++res) {
        c = *it;
        if(!(c&amp;0x80) || ((c&amp;0xC0) == 0xC0)) break;
    }

    return res;
}
</code></pre>

<p>How could I modify this so that I can go back a unicode character from an arbitrary character?</p>

<p>Thanks</p>
