Unroll the loop in encode_utf8()