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 for detect_encoding returning a hash without :encoding key #12

Merged
merged 1 commit into from Sep 12, 2012

Conversation

Holek
Copy link
Contributor

@Holek Holek commented Apr 18, 2012

this can happen for binary strings, or strings that appear as binary:

ruby-1.9.3-p125-perf :017 > "BEGIN:VCARD\n".detect_encoding
 => {:type=>:binary, :confidence=>100} 

@toch
Copy link

toch commented Jun 6, 2012

I've got the same error when trying to detect encoding on an empty string. I confirm that the @Holek's fix works. Thx.

@Holek
Copy link
Contributor Author

Holek commented Aug 11, 2012

This is probably also not the best workaround, as it does not return :binary as encoding, but nil. (At least it's not throwing an error)

@brianmario
Copy link
Owner

ah good catch thanks!

brianmario added a commit that referenced this pull request Sep 12, 2012
fix for detect_encoding returning a hash without :encoding key
@brianmario brianmario merged commit bbcc495 into brianmario:master Sep 12, 2012
@Holek Holek deleted the patch-1 branch April 18, 2013 14:15
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

3 participants