25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

ejabberd_ctl: Fix output of UTF-8-encoded binaries

Converting binary results to char() lists using binary_to_list/1 yields
incorrect results for characters outside the ISO Latin-1 range.
This commit is contained in:
Holger Weiss 2024-06-19 19:51:50 +02:00
parent 0380695bba
commit 40c27b54b0

View File

@ -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)]);