anchor.diff:                  %% coalesce UTF-16 surrogate pair
                   <<"\\u", D3, D2, D1, D0, _/binary>> = Rest,
                   D = erlang:list_to_integer([D3,D2,D1,D0], 16),
  -                [CodePoint] = xmerl_ucs:from_utf16be(<<C:16/big-unsigned-integer,
  -                    D:16/big-unsigned-integer>>),
  -                Acc1 = lists:reverse(xmerl_ucs:to_utf8(CodePoint), Acc),
  +                Acc1 = [unicode:characters_to_binary(
  +                            <<C:16/big-unsigned-integer,
  +                              D:16/big-unsigned-integer>>,
  +                            utf16)
  +                       | Acc],
                   tokenize_string(B, ?ADV_COL(S, 12), Acc1);
               true ->
  -                Acc1 = lists:reverse(xmerl_ucs:to_utf8(C), Acc),
  +                Acc1 = [unicode:characters_to_binary([C]) | Acc],
                   tokenize_string(B, ?ADV_COL(S, 6), Acc1)
               end;
           <<_:O/binary, C1, _/binary>> when C1 < 128 ->
  
positive.code:        json_string_is_safe([16#0001d120])),
      ?assertEqual(
         false,
         json_bin_is_safe(list_to_binary(xmerl_ucs:to_utf8(16#0001d120)))),
      ?assertEqual(
         [16#0001d120],
         xmerl_ucs:from_utf8(
           binary_to_list(
             decode(encode(list_to_atom(xmerl_ucs:to_utf8(16#0001d120))))))),
      ?assertEqual(
         false,
         json_string_is_safe([16#110000])),
      ?assertEqual(
         false,
         json_bin_is_safe(list_to_binary(xmerl_ucs:to_utf8([16#110000])))),
      %% solidus can be escaped but isn't unsafe by default
      ?assertEqual(
         <<"/">>,
  
negative.code:        iolist_to_binary(encode(foo))),
      ?assertEqual(
         <<"\"\\ud834\\udd20\"">>,
         iolist_to_binary(
           encode(
             binary_to_atom(
               unicode:characters_to_binary([16#0001d120]), latin1)))),
      ok.
  
  key_encode_test() ->
  