decode(
str,i) ->cp,next
Decode one UTF-8 sequence at a byte
Decodes the sequence that starts at byte i of str, 1 by default.
Answers its codepoint and the index of the byte after it, so a loop
reads a string as cp, i = decode(str, i) until i is nil.
An ill-formed sequence answers nil and the index to read next, by
Unicode's "maximal subpart" practice: the bytes C0, C1 and F5 to FF, a
stray continuation byte, an overlong form, a surrogate, a codepoint past
U+10FFFF and a sequence cut short. A sequence stops at its first byte
that cannot continue it, and that byte is read next. The second bytes
it takes are the ones valid_seq takes.
Past the end of str, it answers nil and nil.