anchor.diff:  %%      invalid bytes.
   
   -module(mochiutf8).
  --export([valid_utf8_bytes/1, codepoint_to_bytes/1]).
  +-export([valid_utf8_bytes/1, codepoint_to_bytes/1, bytes_to_codepoints/1]).
  +-export([bytes_foldl/3, codepoint_foldl/3, read_codepoint/1, len/1]).
   
   %% External API
   
  -%% @spec codepoint_to_binary(integer()) -> binary()
  +-type unichar_low() :: 0..16#d7ff.
  +-type unichar_high() :: 16#e000..16#10ffff.
  +-type unichar() :: unichar_low() | unichar_high().
  +
  +-spec codepoint_to_bytes(unichar()) -> binary().
   %% @doc Convert a unicode codepoint to UTF-8 bytes.
   codepoint_to_bytes(C) when (C >= 16#00 andalso C =< 16#7f) ->
       %% U+0000 - U+007F - 7 bits
  
positive.code:       2#10:2, B1:6,
        2#10:2, B0:6>>.
  
  %% @spec valid_utf8_bytes(B::binary()) -> binary()
  %% @doc Return only the bytes in B that represent valid UTF-8. Uses
  %%      the following recursive algorithm: skip one byte if B does not
  %%      follow UTF-8 syntax (a 1-4 byte encoding of some number),
  
negative.code:     binary_skip_bytes(B, L, 0, []).
  
  %% @private
  -spec binary_skip_bytes(binary(), [non_neg_integer()], non_neg_integer(), iolist()) -> binary().
  binary_skip_bytes(B, [], _N, Acc) ->
      iolist_to_binary(lists:reverse([B | Acc]));
  binary_skip_bytes(<<_, RestB/binary>>, [N | RestL], N, Acc) ->
  