Created
March 7, 2013 14:07
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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