anchor.diff:      ?assertEqual(<<"2147483648.0">>, iolist_to_binary(encode(2147483648))),
       ok.
   
  +handler_test() ->
  +    ?assertEqual(
  +       {'EXIT',{json_encode,{bad_term,{}}}},
  +       catch encode({})),
  +    F = fun ({}) -> [] end,
  +    ?assertEqual(
  +       <<"[]">>,
  +       iolist_to_binary((encoder([{handler, F}]))({}))),
  +    ok.
  +
   -endif.
  
positive.code:             false;
          $\t ->
              false;
          C when C >= 0, C < $\s; C >= 16#7f, C =< 16#10FFFF ->
              false;
          C when C < 16#7f ->
              json_bin_is_safe(Rest);
          _ ->
              false
      end.
  
  json_encode_string_unicode([], _State, Acc) ->
  
negative.code:        <<"{\"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() ->
  