aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2017-08-24 12:18:53 +0200
committerSiri Hansen <[email protected]>2017-09-05 11:29:38 +0200
commit41b856a2cb270ef807beaa84afe1bb890de5f237 (patch)
tree7990eabdda1f234b5df3485283c5474af5987225
parentd4317108cb50081de28337685e77564854175704 (diff)
downloadotp-41b856a2cb270ef807beaa84afe1bb890de5f237.tar.gz
otp-41b856a2cb270ef807beaa84afe1bb890de5f237.tar.bz2
otp-41b856a2cb270ef807beaa84afe1bb890de5f237.zip
kernel: update simple error logger to print Unicode strings
If printable range is set to 'unicode', the simple error logger will now recognize code points > 255 and print lists containing these as strings.
-rw-r--r--lib/kernel/src/error_logger.erl29
1 files changed, 9 insertions, 20 deletions
diff --git a/lib/kernel/src/error_logger.erl b/lib/kernel/src/error_logger.erl
index 9bf8547745..f07ec52cfa 100644
--- a/lib/kernel/src/error_logger.erl
+++ b/lib/kernel/src/error_logger.erl
@@ -499,27 +499,16 @@ display4(A = [_|_]) ->
display4(A) ->
erlang:display(A).
-string_p([]) ->
+
+string_p(Term) when is_list(Term) ->
+ string_p1(lists:flatten(Term));
+string_p(_Term) ->
+ false.
+
+string_p1([]) ->
false;
-string_p(Term) ->
- string_p1(Term).
-
-string_p1([H|T]) when is_integer(H), H >= $\s, H < 255 ->
- string_p1(T);
-string_p1([$\n|T]) -> string_p1(T);
-string_p1([$\r|T]) -> string_p1(T);
-string_p1([$\t|T]) -> string_p1(T);
-string_p1([$\v|T]) -> string_p1(T);
-string_p1([$\b|T]) -> string_p1(T);
-string_p1([$\f|T]) -> string_p1(T);
-string_p1([$\e|T]) -> string_p1(T);
-string_p1([H|T]) when is_list(H) ->
- case string_p1(H) of
- true -> string_p1(T);
- _ -> false
- end;
-string_p1([]) -> true;
-string_p1(_) -> false.
+string_p1(FlatList) ->
+ io_lib:printable_list(FlatList).
-spec limit_term(term()) -> term().