Skip to content

Instantly share code, notes, and snippets.

@headius
Created January 12, 2011 04:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/775696 to your computer and use it in GitHub Desktop.
Save headius/775696 to your computer and use it in GitHub Desktop.
diff --git a/lib/ruby/1.9/resolv.rb b/lib/ruby/1.9/resolv.rb
index 9a96c55..d535111 100644
--- a/lib/ruby/1.9/resolv.rb
+++ b/lib/ruby/1.9/resolv.rb
@@ -702,7 +702,7 @@ class Resolv
service = [host, port]
id = DNS.allocate_request_id(host, port)
request = msg.encode
- request[0,2] = [id].pack('n')
+ request[0,2] = [id].pack('U')
sock = @socks_hash[host.index(':') ? "::" : "0.0.0.0"]
return @senders[[service, id]] =
Sender.new(request, data, sock, host, port)
@amodig
Copy link

amodig commented May 11, 2016

Today, this old gist helped me to solve this old problem:
http://stackoverflow.com/questions/27944875/error-while-installing-gem-on-windows-8-incompatible-character-encoding

And I don't even know Ruby. Thank you very much!

PS. The problem (https://bugs.ruby-lang.org/issues/4270) still seems to exist, at least on Windows, and it seems resolv-idn is not supported anymore. Maybe the issue should be opened again?

@aderuwe
Copy link

aderuwe commented Mar 6, 2017

Thank you, 6 year old gist!!!!!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment