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

Do not use gzip, invalid byte sequence in UTF-8 (ArgumentError) #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

imustafin
Copy link

Hi. I'm using this gem in ruby 2.7.0. It gives this error:

irb(main):001:0> require 'textrazor'
=> true
irb(main):002:0> client = TextRazor::Client.new('...')
irb(main):003:0> client.analyse('Bill Gates is a co-founder of Microsoft')
Traceback (most recent call last):
        9: from /usr/local/bin/irb:23:in `<main>'
        8: from /usr/local/bin/irb:23:in `load'
        7: from /usr/local/lib/ruby/gems/2.7.0/gems/irb-1.2.3/exe/irb:11:in `<top (required)>'
        6: from (irb):3
        5: from /usr/local/bundle/gems/textrazor-1.1/lib/textrazor/client.rb:37:in `analyse'
        4: from /usr/local/bundle/gems/textrazor-1.1/lib/textrazor/client.rb:37:in `new'
        3: from /usr/local/bundle/gems/textrazor-1.1/lib/textrazor/response.rb:21:in `initialize'
        2: from /usr/local/lib/ruby/2.7.0/json/common.rb:156:in `parse'
        1: from /usr/local/lib/ruby/2.7.0/json/common.rb:156:in `parse'
Traceback (most recent call last):
	17: from /usr/local/bin/irb:23:in `<main>'
	16: from /usr/local/bin/irb:23:in `load'
	15: from /usr/local/lib/ruby/gems/2.7.0/gems/irb-1.2.3/exe/irb:11:in `<top (required)>'
	14: from /usr/local/lib/ruby/2.7.0/irb.rb:399:in `start'
	13: from /usr/local/lib/ruby/2.7.0/irb.rb:470:in `run'
	12: from /usr/local/lib/ruby/2.7.0/irb.rb:470:in `catch'
	11: from /usr/local/lib/ruby/2.7.0/irb.rb:471:in `block in run'
	10: from /usr/local/lib/ruby/2.7.0/irb.rb:536:in `eval_input'
	 9: from /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:134:in `each_top_level_statement'
	 8: from /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:134:in `catch'
	 7: from /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:135:in `block in each_top_level_statement'
	 6: from /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:135:in `loop'
	 5: from /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:150:in `block (2 levels) in each_top_level_statement'
	 4: from /usr/local/lib/ruby/2.7.0/irb.rb:537:in `block in eval_input'
	 3: from /usr/local/lib/ruby/2.7.0/irb.rb:695:in `signal_status'
	 2: from /usr/local/lib/ruby/2.7.0/irb.rb:550:in `block (2 levels) in eval_input'
	 1: from /usr/local/lib/ruby/2.7.0/irb.rb:598:in `handle_exception'
/usr/local/lib/ruby/2.7.0/irb.rb:598:in `split': invalid byte sequence in UTF-8 (ArgumentError)

Disabling gzip fixes this problem. Alternative solution can be to handle gzip response correctly.

@andhapp
Copy link
Owner

andhapp commented Aug 18, 2020

Hey, thanks for the PR. Did this work for you before and broke in ruby 2.7? No one reported this before, so I wonder this could be a ruby 2.7 particular issue.

@imustafin
Copy link
Author

I haven't used this gem in ruby < 2.7, so I don't know.

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.

2 participants