Skip to content

Commit

Permalink
ejabberd_ctl: Fix output of UTF-8-encoded binaries
Browse files Browse the repository at this point in the history
Converting binary results to char() lists using binary_to_list/1 yields
incorrect results for characters outside the ISO Latin-1 range.
  • Loading branch information
weiss committed Jun 19, 2024
1 parent 0380695 commit 40c27b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ejabberd_ctl.erl
Original file line number Diff line number Diff line change
Expand Up @@ -410,13 +410,13 @@ format_result([A|_]=String, {_Name, string}, _Version) when is_list(String) and
io_lib:format("~ts", [String]);
format_result(Binary, {_Name, binary}, _Version) when is_binary(Binary) ->
io_lib:format("~ts", [binary_to_list(Binary)]);
io_lib:format("~ts", [Binary]);
format_result(String, {_Name, binary}, _Version) when is_list(String) ->
io_lib:format("~ts", [String]);
format_result(Binary, {_Name, string}, _Version) when is_binary(Binary) ->
io_lib:format("~ts", [binary_to_list(Binary)]);
io_lib:format("~ts", [Binary]);
format_result(Atom, {_Name, string}, _Version) when is_atom(Atom) ->
io_lib:format("~ts", [atom_to_list(Atom)]);
Expand Down

0 comments on commit 40c27b5

Please sign in to comment.