httparty: httparty 0.15.2: incompatible encoding regexp match
Hi folks, I use httparty to interact with an API and I upgraded from v 0.14.x to v0.15.2. Now I’m getting the following error:
Encoding::CompatibilityError: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)`
from /home/app/bundle/gems/httparty-0.15.2/lib/httparty/parser.rb:120:in `gsub'
from /home/app/bundle/gems/httparty-0.15.2/lib/httparty/parser.rb:120:in `json'
from /home/app/bundle/gems/httparty-0.15.2/lib/httparty/parser.rb:140:in `parse_supported_format'
from /home/app/bundle/gems/httparty-0.15.2/lib/httparty/parser.rb:105:in `parse'
from /home/app/bundle/gems/httparty-0.15.2/lib/httparty/parser.rb:67:in `call'
from /home/app/bundle/gems/httparty-0.15.2/lib/httparty/request.rb:383:in `parse_response'
from /home/app/bundle/gems/httparty-0.15.2/lib/httparty/request.rb:351:in `block in handle_response'
from /home/app/bundle/gems/httparty-0.15.2/lib/httparty/response.rb:25:in `parsed_response'
from /home/app/bundle/gems/httparty-0.15.2/lib/httparty/response.rb:88:in `method_missing'
Environment details:
RubyOnRails 5.0.3
Ruby 2.3.3
Character encoding of API response is UTF-8 (checked in chrome developer tools with document.characterSet)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 27 (12 by maintainers)
Commits related to this issue
- [#533] Prevent gsub errors with different encodings — committed to rsullivan00/httparty by rsullivan00 7 years ago
- Merge pull request #538 from Rsullivan00/rs/encoding-issues [#533] Prevent gsub errors with different encodings — committed to jnunemaker/httparty by jnunemaker 7 years ago
I have the same issue … also after upgrading from 0.14.x to 0.15.x.
It looks like it was introduced in #520
0.15.4 is out and should help with this.