Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UnicodeConversionError #5

Merged
merged 3 commits into from
Mar 10, 2022

Conversation

adriankumpf
Copy link
Contributor

@adriankumpf adriankumpf commented Mar 10, 2022

This fixes a UnicodeConversionError that gets raised by String.to_charlist/1 if Infer.Text.html? or Infer.Text.xml? receive a binary that is not UTF-8 encoded.

iex> String.to_charlist <<0xFF>>
** (UnicodeConversionError) invalid encoding starting at <<255>>
    (elixir 1.13.3) lib/string.ex:2407: String.to_charlist/1

iex> :binary.bin_to_list <<0xFF>>
[255]

I also added a bunch of Infer.Matchers tests for unexpected inputs, which increases the time to run the whole test suite a bit, mostly due to the size of some test files.

Copy link
Owner

@daskycodes daskycodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a bunch for the PR! 🚀

I will look into smaller test files as an improvement for getting the test suite even to better speeds!

@daskycodes daskycodes merged commit 325adb6 into daskycodes:main Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants