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 Encoding::CompatibilityError: incompatible encoding regexp match … #12

Merged
merged 1 commit into from
Jul 4, 2017

Conversation

Panczo
Copy link
Contributor

@Panczo Panczo commented May 19, 2017

Hi @aegorov,

This is a fix for error Encoding::CompatibilityError: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string).
I encountered it when I wanted to translate text that includes special characters.

translator.translate 'Car', from: 'ru'
=>
Encoding::CompatibilityError: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string) from ../ruby-2.4.0/gems/httparty-0.15.3/lib/httparty/parser.rb:120:ingsub

According to @ericgj from jnunemaker/httparty#75 I've changed default httparty's parser, that fixed this problem.

In order to test request with vcr gem, I've created a new spec file called translator_vcr_spec.rb.
In my test, request requires real api_key, so once you'll get it, create a file spec/secrets.yml, and put it there:
yandex_translator_api_key: your_api_key
This pull request also includes vcr's cassets files, they are inside spec/vcr folder.

@aegorov
Copy link
Owner

aegorov commented Jul 4, 2017

@Panczo Sorry for long pause, thank you for work!

@aegorov aegorov merged commit c30ab6f into aegorov:master Jul 4, 2017
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