test for noncharacters, fixed bug discovered by test

This commit is contained in:
alisdair sullivan 2011-07-26 19:28:41 -07:00
parent 4ba8c4d57e
commit c5c98482fc
2 changed files with 18 additions and 3 deletions

View file

@ -542,9 +542,10 @@ low_surrogate(<<D/?utfx, Rest/binary>>, Stack, Opts, String, [C, B, A], High)
X when X >= 16#dc00, X =< 16#dfff ->
V = surrogate_to_codepoint(High, X),
case V rem 16#10000 of
X when X == 16#fffe; X == 16#ffff ->
Y when Y == 16#fffe; Y == 16#ffff ->
{error, {badjson, <<D/?utfx, Rest/binary>>}}
; _ ->
; Y ->
io:format("~p ~p~n", [V, Y]),
string(Rest, Stack, Opts, <<String/binary, V/utf8>>)
end
%% not a low surrogate, bad bad bad