From 2f21ad26a9f3000d62660edde22874603aa2baaa Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Tue, 19 Jun 2012 14:18:29 +0200 Subject: Format latin binary strings in table viewer --- lib/observer/src/observer_tv_table.erl | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/observer/src/observer_tv_table.erl') diff --git a/lib/observer/src/observer_tv_table.erl b/lib/observer/src/observer_tv_table.erl index f18d346f83..8fdcbf331c 100644 --- a/lib/observer/src/observer_tv_table.erl +++ b/lib/observer/src/observer_tv_table.erl @@ -24,6 +24,8 @@ -export([init/1, handle_info/2, terminate/2, code_change/3, handle_call/3, handle_event/2, handle_sync_event/3, handle_cast/2]). +-export([format/1]). + -include("observer_defs.hrl"). -import(observer_lib, [to_str/1]). @@ -748,6 +750,13 @@ format(List) when is_list(List) -> format_list(List); format(Bin) when is_binary(Bin), byte_size(Bin) > 100 -> io_lib:format("<<#Bin:~w>>", [byte_size(Bin)]); +format(Bin) when is_binary(Bin) -> + try + true = printable_list(unicode:characters_to_list(Bin)), + io_lib:format("<<\"~ts\">>", [Bin]) + catch _:_ -> + io_lib:format("~w", [Bin]) + end; format(Float) when is_float(Float) -> io_lib:format("~.3g", [Float]); format(Term) -> -- cgit v1.2.3