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 handling of invalid UTF-8 byte sequences in Ruby 1.9+. #840

Closed
wants to merge 1 commit into from

Conversation

geoff-nixon
Copy link
Contributor

This pull request is a proposal to fix #830, and closes #829.

Basically:

Tested with Ruby 1.8.7p358 and 2.0.0p353 on Darwin.

This pull request is a proposal to fix github-linguist#830, and closes github-linguist#829.

Basically:
 - explicitly convert text to UTF-8, replacing invalid characters
   prior to spitting into lines and parsing. See changes in [blob_helper.rb](https://github.com/pullreq/linguist/blob/master/lib/linguist/blob_helper.rb).
 - Adds the test case (from LLVM's [lit](http://llvm.org/docs/CommandGuide/lit.html) testsuite) as [samples/Python/invalid-encoding.py](https://github.com/pullreq/linguist/blob/samples/Python/invalid-encoding.py).

Tested with Ruby 1.8.7p358 and 2.0.0p353 on Darwin.
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linguist is tongue-tied when it encounters invalid/inconsistent encodings.
1 participant