diff options
author | Hans Bolinder <[email protected]> | 2017-06-14 13:16:47 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2017-09-05 11:02:25 +0200 |
commit | 2ca6b53da655b4c1377e8ddb818ce70c71e3538e (patch) | |
tree | 819e8ed1d4e5856334cf1a43396cc1148b7fb556 /lib/stdlib/src | |
parent | bb8a07ca8295a506e06fbf0b2173e6cd55b3d523 (diff) | |
download | otp-2ca6b53da655b4c1377e8ddb818ce70c71e3538e.tar.gz otp-2ca6b53da655b4c1377e8ddb818ce70c71e3538e.tar.bz2 otp-2ca6b53da655b4c1377e8ddb818ce70c71e3538e.zip |
stdlib: Modify handling of Unicode in proc_lib
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/proc_lib.erl | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/stdlib/src/proc_lib.erl b/lib/stdlib/src/proc_lib.erl index d4d1bdccec..8e10cbe93b 100644 --- a/lib/stdlib/src/proc_lib.erl +++ b/lib/stdlib/src/proc_lib.erl @@ -823,22 +823,22 @@ to_string(A, _) -> io_lib:write_atom(A). pp_fun({Enc,Depth}) -> - {Letter,Tl} = case Depth of - unlimited -> {"p",[]}; - _ -> {"P",[Depth]} - end, - P = modifier(Enc) ++ Letter, + {P,Tl} = p(Enc, Depth), fun(Term, I) -> io_lib:format("~." ++ integer_to_list(I) ++ P, [Term|Tl]) end. -format_tag(Indent, Tag, Data, {_Enc,Depth}) -> - case Depth of - unlimited -> - io_lib:format("~s~p: ~80.18p~n", [Indent, Tag, Data]); - _ -> - io_lib:format("~s~p: ~80.18P~n", [Indent, Tag, Data, Depth]) - end. +format_tag(Indent, Tag, Data, {Enc,Depth}) -> + {P,Tl} = p(Enc, Depth), + io_lib:format("~s~p: ~80.18" ++ P ++ "\n", [Indent, Tag, Data|Tl]). + +p(Encoding, Depth) -> + {Letter, Tl} = case Depth of + unlimited -> {"p", []}; + _ -> {"P", [Depth]} + end, + P = modifier(Encoding) ++ Letter, + {P, Tl}. modifier(latin1) -> ""; modifier(_) -> "t". |