Skip to content

Instantly share code, notes, and snippets.

@strzibny
Created March 7, 2013 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strzibny/5108279 to your computer and use it in GitHub Desktop.
Save strzibny/5108279 to your computer and use it in GitHub Desktop.
idn RubyGem patch for Ruby 2 which has standard encoding set to UTF-8 so you cannot count on comparison with standard strings
diff --git a/test/tc_Stringprep.rb b/test/tc_Stringprep.rb
index c7f15cb..bcdd401 100644
--- a/test/tc_Stringprep.rb
+++ b/test/tc_Stringprep.rb
@@ -60,7 +60,7 @@ class Test_Stringprep < Test::Unit::TestCase
def test_with_profile_STRINGPREP
TESTCASES_STRINGPREP.each do |key, val|
rc = Stringprep.with_profile(val[1], val[0])
- assert_equal(val[2], rc, "TestCase #{key} failed")
+ assert_equal(val[2].force_encoding('ASCII-8BIT'), rc, "TestCase #{key} failed")
end
end
@@ -75,7 +75,7 @@ class Test_Stringprep < Test::Unit::TestCase
def test_nfkc_normalize_NFKC
TESTCASES_NFKC.each do |key, val|
rc = Stringprep.nfkc_normalize(val[0])
- assert_equal(val[1], rc, "TestCase #{key} failed")
+ assert_equal(val[1].force_encoding('ASCII-8BIT'), rc, "TestCase #{key} failed")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment