@andralex, this comment troubles me. If range composition isn't suitable for library code, I consider that a considerable failure. Wasn't the whole point that lazy ranges gave us expressive power with almost no compromises? Simple while still being correct? The phrase "oh, that was just an example, here's the real code" comes to mind.

Of course, if the issue you are referring to is that it does UTF decoding even when it doesn't have to, then forget what I just said.