summaryrefslogtreecommitdiff
path: root/src/mochiweb/mochijson.erl
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2009-11-21 17:01:50 +0000
committerAdam Kocoloski <kocolosk@apache.org>2009-11-21 17:01:50 +0000
commit3a4fad07cb5097598eefd0cd7f588c5881a61c8f (patch)
tree6945d805eb72a37a5b27ae14a7ec2d1e8690fdac /src/mochiweb/mochijson.erl
parenta2ebd6155b8171befd8f55b42c48bc563bb330b0 (diff)
upgrade mochiweb to r113, use hooks instead of forking mochijson2. COUCHDB-474
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@882941 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/mochiweb/mochijson.erl')
-rw-r--r--src/mochiweb/mochijson.erl17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/mochiweb/mochijson.erl b/src/mochiweb/mochijson.erl
index 029642ac..74695a75 100644
--- a/src/mochiweb/mochijson.erl
+++ b/src/mochiweb/mochijson.erl
@@ -186,7 +186,8 @@ json_encode_string_utf8_1([C | Cs]) when C >= 0, C =< 16#7f ->
end,
[NewC | json_encode_string_utf8_1(Cs)];
json_encode_string_utf8_1(All=[C | _]) when C >= 16#80, C =< 16#10FFFF ->
- json_encode_string_unicode(xmerl_ucs:from_utf8(All));
+ [?Q | Rest] = json_encode_string_unicode(xmerl_ucs:from_utf8(All)),
+ Rest;
json_encode_string_utf8_1([]) ->
"\"".
@@ -459,16 +460,18 @@ equiv_object(Props1, Props2) ->
equiv_list([], []) ->
true;
equiv_list([V1 | L1], [V2 | L2]) ->
- case equiv(V1, V2) of
- true ->
- equiv_list(L1, L2);
- false ->
- false
- end.
+ equiv(V1, V2) andalso equiv_list(L1, L2).
test_all() ->
+ test_issue33(),
test_one(e2j_test_vec(utf8), 1).
+test_issue33() ->
+ %% http://code.google.com/p/mochiweb/issues/detail?id=33
+ Js = {struct, [{"key", [194, 163]}]},
+ Encoder = encoder([{input_encoding, utf8}]),
+ "{\"key\":\"\\u00a3\"}" = lists:flatten(Encoder(Js)).
+
test_one([], _N) ->
%% io:format("~p tests passed~n", [N-1]),
ok;