aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl/src/misc_supp.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2017-06-12 17:59:05 +0200
committerSiri Hansen <[email protected]>2017-06-16 11:52:21 +0200
commitaa4c93a7e04ce57584f7591b2b0cc62f4407ca00 (patch)
tree85fac17bf876b0f26bbb0c123ba9ed9c7b788059 /lib/sasl/src/misc_supp.erl
parentb21f42298cfab6374f2f1d433747399a6e1c9f5c (diff)
downloadotp-aa4c93a7e04ce57584f7591b2b0cc62f4407ca00.tar.gz
otp-aa4c93a7e04ce57584f7591b2b0cc62f4407ca00.tar.bz2
otp-aa4c93a7e04ce57584f7591b2b0cc62f4407ca00.zip
[sasl] Improve handling of unicode in rb
Diffstat (limited to 'lib/sasl/src/misc_supp.erl')
-rw-r--r--lib/sasl/src/misc_supp.erl18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/sasl/src/misc_supp.erl b/lib/sasl/src/misc_supp.erl
index 093b337a2c..b32f63ebf4 100644
--- a/lib/sasl/src/misc_supp.erl
+++ b/lib/sasl/src/misc_supp.erl
@@ -32,7 +32,7 @@
%%%---------------------------------------------------------------------
-export([format_pdict/3, format_tuples/2, assq/2, passq/2, is_string/1,
- multi_map/2]).
+ multi_map/2, modifier/1]).
%%-----------------------------------------------------------------
%% Uses format_tuples to format the data in process dictionary.
@@ -105,3 +105,19 @@ multi_map(Func, ListOfLists) ->
[apply(Func, lists:map(fun(List) -> hd(List) end, ListOfLists)) |
multi_map(Func,
lists:map(fun(List) -> tl(List) end, ListOfLists))].
+
+%%%-----------------------------------------------------------------
+%%% Check encoding of the given device and return "t" if this format
+%%% modifier should be used.
+modifier(Device) ->
+ Encoding =
+ case io:getopts(Device) of
+ List when is_list(List) ->
+ proplists:get_value(encoding,List,latin1);
+ _ ->
+ latin1
+ end,
+ encoding_to_modifier(Encoding).
+
+encoding_to_modifier(latin1) -> "";
+encoding_to_modifier(_) -> "t".