| a | b | |
|---|
| 0 | + | diff --git a/src/mochiweb/mochijson2.erl b/src/mochiweb/mochijson2.erl |
|---|
| 0 | + | index bdf6d77..c1c2be6 100644 |
|---|
| 0 | + | --- a/src/mochiweb/mochijson2.erl |
|---|
| 0 | + | +++ b/src/mochiweb/mochijson2.erl |
|---|
| 0 | + | @@ -172,28 +172,31 @@ json_encode_proplist(Props, State) -> |
|---|
| 0 | + | |
|---|
| 0 | + | json_encode_string(A, State) when is_atom(A) -> |
|---|
| 0 | + | L = atom_to_list(A), |
|---|
| 0 | + | - case json_string_is_safe(L) of |
|---|
| 0 | + | - true -> |
|---|
| 0 | + | - [?Q, L, ?Q]; |
|---|
| 0 | + | - false -> |
|---|
| 0 | + | - json_encode_string_unicode(xmerl_ucs:from_utf8(L), State, [?Q]) |
|---|
| 0 | + | - end; |
|---|
| 0 | + | + [?Q, L, ?Q]; |
|---|
| 0 | + | + %% case json_string_is_safe(L) of |
|---|
| 0 | + | + %% true -> |
|---|
| 0 | + | + %% [?Q, L, ?Q]; |
|---|
| 0 | + | + %% false -> |
|---|
| 0 | + | + %% json_encode_string_unicode(xmerl_ucs:from_utf8(L), State, [?Q]) |
|---|
| 0 | + | + %% end; |
|---|
| 0 | + | json_encode_string(B, State) when is_binary(B) -> |
|---|
| 0 | + | - case json_bin_is_safe(B) of |
|---|
| 0 | + | - true -> |
|---|
| 0 | + | - [?Q, B, ?Q]; |
|---|
| 0 | + | - false -> |
|---|
| 0 | + | - json_encode_string_unicode(xmerl_ucs:from_utf8(B), State, [?Q]) |
|---|
| 0 | + | - end; |
|---|
| 0 | + | + [?Q, B, ?Q]; |
|---|
| 0 | + | + %% case json_bin_is_safe(B) of |
|---|
| 0 | + | + %% true -> |
|---|
| 0 | + | + %% [?Q, B, ?Q]; |
|---|
| 0 | + | + %% false -> |
|---|
| 0 | + | + %% json_encode_string_unicode(xmerl_ucs:from_utf8(B), State, [?Q]) |
|---|
| 0 | + | + %% end; |
|---|
| 0 | + | json_encode_string(I, _State) when is_integer(I) -> |
|---|
| 0 | + | [?Q, integer_to_list(I), ?Q]; |
|---|
| 0 | + | json_encode_string(L, State) when is_list(L) -> |
|---|
| 0 | + | - case json_string_is_safe(L) of |
|---|
| 0 | + | - true -> |
|---|
| 0 | + | - [?Q, L, ?Q]; |
|---|
| 0 | + | - false -> |
|---|
| 0 | + | - json_encode_string_unicode(L, State, [?Q]) |
|---|
| 0 | + | - end. |
|---|
| 0 | + | + [?Q, L, ?Q]. |
|---|
| 0 | + | + %% case json_string_is_safe(L) of |
|---|
| 0 | + | + %% true -> |
|---|
| 0 | + | + %% [?Q, L, ?Q]; |
|---|
| 0 | + | + %% false -> |
|---|
| 0 | + | + %% json_encode_string_unicode(L, State, [?Q]) |
|---|
| 0 | + | + %% end. |
|---|
| 0 | + | |
|---|
| 0 | + | json_string_is_safe([]) -> |
|---|
| 0 | + | true; |
|---|
| ... | |
|---|