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

SocketError: message has ASCII-8BIT encoding #4

Closed
ochaochaocha3 opened this issue May 5, 2020 · 0 comments
Closed

SocketError: message has ASCII-8BIT encoding #4

ochaochaocha3 opened this issue May 5, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ochaochaocha3
Copy link
Member

ochaochaocha3 commented May 5, 2020

Cinch::IRC#connect may log the SocketError that occurred on a connection.
In a non-English Windows environment, the message of that exception has the ASCII-8BIT encoding which causes an Encoding::CompatibilityError on encoding it to UTF-8.
I confirmed it on Ubuntu 18.04 running in VirtualBox on a Windows host.

Solution

begin
  # ...
rescue SocketError => e
  e.message.force_encoding(Encoding.default_external)
end

References

@ochaochaocha3 ochaochaocha3 added the bug Something isn't working label May 5, 2020
@ochaochaocha3 ochaochaocha3 self-assigned this May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant