This doesn't work well with handling ill-formed sequences.
The length is of course known upfront if not of the whole string but at least of the individual small substring.
Re:The UTF-8-Everywhere Manifesto
by colanderman on Sunday April 29, 2012 @10:58PM
(#3907850)
OK, I thought you meant a code point containing all 1s. Thanks for clearing that up.
A byte containing all 1s is not valid in any Unicode encoding, so if one appears, you'd know you had hit the end of the string.