From 568cb052c7be7e36f96ddd18001529e371790b4b Mon Sep 17 00:00:00 2001 From: Patrik Nyblom Date: Mon, 18 Feb 2013 15:12:37 +0100 Subject: Leave the +pc handling to io and io_lib_pretty This makes the shell output binaries and list as intended by the +pc setting. --- lib/stdlib/src/shell.erl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl index c90b5ad5c8..96f3e5dd32 100644 --- a/lib/stdlib/src/shell.erl +++ b/lib/stdlib/src/shell.erl @@ -570,7 +570,7 @@ report_exception(Class, Severity, {Reason,Stacktrace}, RT) -> I = iolist_size(Tag) + 1, PF = fun(Term, I1) -> pp(Term, I1, RT) end, SF = fun(M, _F, _A) -> (M =:= erl_eval) or (M =:= ?MODULE) end, - Enc = io:printable_range(), + Enc = encoding(), Str = lib:format_exception(I, Class, Reason, Stacktrace, SF, PF, Enc), io:requests([{put_chars, latin1, Tag}, {put_chars, unicode, Str}, @@ -1384,9 +1384,14 @@ columns() -> {ok,N} -> N; _ -> 80 end. - +encoding() -> + [{encoding, Encoding}] = enc(), + Encoding. enc() -> - [{encoding, io:printable_range()}]. + case lists:keyfind(encoding, 1, io:getopts()) of + false -> [{encoding,latin1}]; % should never happen + Enc -> [Enc] + end. garb(Shell) -> erlang:garbage_collect(Shell), -- cgit v1.2.3