Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixing Ruby 1.8 issue (Encoding class not available)

  • Loading branch information...
commit 77d45541d85c26ce235b6c494bd94b37b61edb5a 1 parent a04853a
Cameron Dutro authored
Showing with 10 additions and 9 deletions.
  1. +10 −9 spec/normalizers/canonical/nfd_spec.rb
19 spec/normalizers/canonical/nfd_spec.rb
View
@@ -32,16 +32,17 @@
describe "#normalize_code_points" do
it "passes all the tests in NormalizersTest.txt" do
- Encoding.default_external = Encoding::UTF_8
normalization_test_file = File.join(File.dirname(File.dirname(__FILE__)), "NormalizationTest.txt")
- lines = IO.readlines(normalization_test_file).each do |line|
- unless line[0] =~ /(@|#)/ || line.empty?
- c1, c2, c3, c4, c5 = line.split(';')[0...5].map { |cps| cps.split }
- NFD.normalize_code_points(c1).should == c3
- NFD.normalize_code_points(c2).should == c3
- NFD.normalize_code_points(c3).should == c3
- NFD.normalize_code_points(c4).should == c5
- NFD.normalize_code_points(c5).should == c5
+ File.open(normalization_test_file, "r:UTF-8") do |file|
+ while line = file.gets
+ unless line =~ /(@|#)/ || line.empty?
+ c1, c2, c3, c4, c5 = line.split(';')[0...5].map { |cps| cps.split }
+ NFD.normalize_code_points(c1).should == c3
+ NFD.normalize_code_points(c2).should == c3
+ NFD.normalize_code_points(c3).should == c3
+ NFD.normalize_code_points(c4).should == c5
+ NFD.normalize_code_points(c5).should == c5
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.