mobiledefense/google_safe_browsing — pull request #5 by bethcrb (2013-07-12 02:24:34+00:00)
Title: Ensure URLs use ASCII encoding

Ruby 2.0 now defaults to UTF-8 encoding which results in this message when you run rspec:

Failures:

1) GoogleSafeBrowsing::Canonicalize should pass Units tests provided by Google
Failure/Error: GoogleSafeBrowsing::Canonicalize.url("http://\x01\x80.com/").should == "http://%01%80.com/";
ArgumentError:
invalid byte sequence in UTF-8
# ./lib/google_safe_browsing/canonicalize.rb:20:in `gsub!'
# ./lib/google_safe_browsing/canonicalize.rb:20:in `url'
# ./spec/canonicalize_spec.rb:28:in `block (2 levels) in '

As the URLs were encoded in ASCII and ASCII-8BIT before, forcing the encoding to ASCII-8BIT resolves the issue.