anchor.diff:         <<"{\"foo\":1}">>,
          iolist_to_binary(encode({struct, [{"foo", 1}]}))),
       ?assertEqual(
  +       <<"{\"\\ud834\\udd20\":1}">>,
  +       iolist_to_binary(
  +         encode({struct, [{[16#0001d120], 1}]}))),
  +    ?assertEqual(
          <<"{\"1\":1}">>,
          iolist_to_binary(encode({struct, [{1, 1}]}))),
  +    ok.
  +
  +unsafe_chars_test() ->
  +    Chars = "\"\\\b\f\n\r\t",
  +    [begin
  +         ?assertEqual(false, json_string_is_safe([C])),
  +         ?assertEqual(false, json_bin_is_safe(<<C>>)),
  +         ?assertEqual(<<C>>, decode(encode(<<C>>)))
  +     end || C <- Chars],
  +    ?assertEqual(
  +       false,
  +       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(
  +       <<"/">>,
  +       decode(<<"\"\\/\"">>)),
  +    ok.
  +
  +int_test() ->
  +    ?assertEqual(0, decode("0")),
  +    ?assertEqual(1, decode("1")),
  +    ?assertEqual(11, decode("11")),
       ok.
   
   float_fallback_test() ->
  
positive.code:         %% we don't support code points > 10FFFF per RFC 3629
          <<?Q, 16#F5, 16#80, 16#80, 16#80, ?Q>>
      ],
      lists:foreach(fun(X) ->
          ok = try decode(X) catch invalid_utf8 -> ok end
      end, Bad).
  
  inline_json_test() ->
      ?assertEqual(<<"\"iodata iodata\"">>,
  
negative.code:             false;
          $\t ->
              false;
          C when C >= 0, C < $\s; C >= 16#7f ->
              false;
          C when C < 16#7f ->
              json_bin_is_safe(Rest)
      end.
  
  json_encode_string_unicode([], _State, Acc) ->
  