Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Handle non-ASCII characters in WHOIS responses #13

Merged
merged 1 commit into from

2 participants

Cédric Félizard Joël Franusic
Cédric Félizard

String#split raises "invalid byte sequence in UTF-8 (ArgumentError)" (Ruby 1.9.3) when it encounters non-ASCII characters like à, é, etc. Using String#lines fixes that.

Tested on Ruby 1.8.7 and 1.9.3.

Joël Franusic
Owner

Awesome! Thank you sir!

Joël Franusic jpf merged commit 4e027ce into from
Cédric Félizard

You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 30, 2012
  1. Cédric Félizard
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +1 −1  lib/domain-profiler/whois.rb
  2. +6 −0 spec/whois/whois_spec.rb
2  lib/domain-profiler/whois.rb
View
@@ -1,7 +1,7 @@
class Whois
def parse(data)
- @data = data.to_s.split("\n")
+ @data = data.to_s.lines
# com = verisign
# net = verisign
# org = pir
6 spec/whois/whois_spec.rb
View
@@ -36,6 +36,12 @@
whois.registrar.should == ['Unknown']
end
+ it "is able to deal with non-ASCII string input" do
+ whois = Whois.new
+ whois.parse("\xEA")
+ whois.registrar.should == ['Unknown']
+ end
+
it "knows when the domain expires" do
@zombo.expires.should == '10-oct-2010'
end
Something went wrong with that request. Please try again.