Open
Description
Hello!
The error:
** (FunctionClauseError) no function clause matching in String.contains?/2
(elixir) lib/string.ex:1767: String.contains?({:incomplete, "⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐", <<226>>}, "example")
(exirc) lib/exirc/client.ex:721: ExIrc.Client.handle_data/2
(stdlib) gen_server.erl:601: :gen_server.try_dispatch/4
(stdlib) gen_server.erl:667: :gen_server.handle_msg/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
I have investigated it a little bit and think that the problem is here:
|> Enum.map(fn(s) ->
case String.valid?(s) do
true -> :unicode.characters_to_binary(s)
false -> :unicode.characters_to_binary(s, :latin1, :unicode)
end
end)
https://github.com/bitwalker/exirc/blob/master/lib/exirc/utils.ex#L81
From the erlang doc:
characters_to_binary
Result =
binary() |
{error, binary(), RestData} |
{incomplete, binary(), binary()}
http://erlang.org/doc/man/unicode.html#characters_to_binary-1
So basically we need to handle the situation when the string is incomplete, maybe a fallback to empty string would be enough?
I'm not sure about the proper solution, any ideas?
Thank you!
Metadata
Metadata
Assignees
Labels
No labels