icu_tournament 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,23 +21,7 @@ module ICU
21
21
  nil
22
22
  end
23
23
  end
24
-
25
- # Decide if a string is valid UTF-8 or not, returning true or false.
26
- def self.is_utf8(str)
27
- dup = str.dup
28
- dup.force_encoding("UTF-8")
29
- dup.valid_encoding?
30
- end
31
-
32
- # Try to convert any string to UTF-8.
33
- def self.to_utf8(str)
34
- utf8 = is_utf8(str)
35
- dup = str.dup
36
- return dup.force_encoding("UTF-8") if utf8
37
- dup.force_encoding("Windows-1252") if dup.encoding.name.match(/^(ASCII-8BIT|UTF-8)$/)
38
- dup.encode("UTF-8")
39
- end
40
-
24
+
41
25
  # Read UTF data from a file.
42
26
  def self.read_utf8(name)
43
27
  File.open(name, "r:ASCII-8BIT") do |f|
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ICU
4
4
  class Tournament
5
- VERSION = "1.2.4"
5
+ VERSION = "1.2.5"
6
6
  end
7
7
  end
data/spec/util_spec.rb CHANGED
@@ -35,37 +35,6 @@ module ICU
35
35
  end
36
36
  end
37
37
 
38
- context "#is_utf8" do
39
- it "should recognise US-ASCII as a special case of UTF-8" do
40
- Util.is_utf8("Resume".encode("US-ASCII")).should be_true
41
- end
42
-
43
- it "should recognise UTF-8" do
44
- Util.is_utf8("Résumé").should be_true
45
- Util.is_utf8("δog").should be_true
46
- end
47
-
48
- it "should recognize other encodings as not being UTF-8" do
49
- Util.is_utf8("Résumé".encode("ISO-8859-1")).should be_false
50
- Util.is_utf8("€50".encode("Windows-1252")).should be_false
51
- Util.is_utf8("ひらがな".encode("Shift_JIS")).should be_false
52
- Util.is_utf8("\xa3").should be_false
53
- end
54
- end
55
-
56
- context "#to_utf8" do
57
- it "should convert to UTF-8" do
58
- Util.to_utf8("Resume").should == "Resume"
59
- Util.to_utf8("Resume".force_encoding("US-ASCII")).encoding.name.should == "UTF-8"
60
- Util.to_utf8("Résumé".encode("ISO-8859-1")).should == "Résumé"
61
- Util.to_utf8("Résumé".encode("Windows-1252")).should == "Résumé"
62
- Util.to_utf8("€50".encode("Windows-1252")).should == "€50"
63
- Util.to_utf8("\xa350".force_encoding("ASCII-8BIT")).should == "£50"
64
- Util.to_utf8("\xa350").should == "£50"
65
- Util.to_utf8("ひらがな".encode("Shift_JIS")).should == "ひらがな"
66
- end
67
- end
68
-
69
38
  context "#read_utf8" do
70
39
  before(:all) do
71
40
  @s = File.dirname(__FILE__) + '/samples/file'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 2
8
- - 4
9
- version: 1.2.4
8
+ - 5
9
+ version: 1.2.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Orr
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-14 00:00:00 +00:00
17
+ date: 2011-01-21 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -58,8 +58,8 @@ dependencies:
58
58
  segments:
59
59
  - 0
60
60
  - 0
61
- - 3
62
- version: 0.0.3
61
+ - 4
62
+ version: 0.0.4
63
63
  type: :runtime
64
64
  version_requirements: *id003
65
65
  - !ruby/object:Gem::Dependency