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

Improve previous commit

This commit is contained in:
Evgeny Khramtsov 2019-07-11 00:13:39 +03:00
parent 6fd736d496
commit 19cbbf69b2

View File

@ -147,10 +147,12 @@ load_file(File) ->
{ok, Lines} -> {ok, Lines} ->
lists:map( lists:map(
fun({In, Out}) -> fun({In, Out}) ->
try try {unicode:characters_to_binary(In, utf8),
InB = unicode:characters_to_binary(In, utf8), unicode:characters_to_binary(Out, utf8)} of
OutB = unicode:characters_to_binary(Out, utf8), {InB, OutB} when is_binary(InB), is_binary(OutB) ->
{{Lang, InB}, OutB} {{Lang, InB}, OutB};
_ ->
{error, File, bad_encoding}
catch _:badarg -> catch _:badarg ->
{error, File, bad_encoding} {error, File, bad_encoding}
end; end;