gigo 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/kencollins/Repositories/customink/gigo
3
3
  specs:
4
- gigo (1.2.0)
4
+ gigo (1.4.0)
5
5
  activesupport (>= 3.0)
6
6
  ensure_valid_encoding (~> 0.5.3)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/kencollins/Repositories/customink/gigo
3
3
  specs:
4
- gigo (1.2.0)
4
+ gigo (1.4.0)
5
5
  activesupport (>= 3.0)
6
6
  ensure_valid_encoding (~> 0.5.3)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/kencollins/Repositories/customink/gigo
3
3
  specs:
4
- gigo (1.2.0)
4
+ gigo (1.4.0)
5
5
  activesupport (>= 3.0)
6
6
  ensure_valid_encoding (~> 0.5.3)
7
7
 
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: /Users/kencollins/Repositories/customink/gigo
14
14
  specs:
15
- gigo (1.2.0)
15
+ gigo (1.4.0)
16
16
  activesupport (>= 3.0)
17
17
  ensure_valid_encoding (~> 0.5.3)
18
18
 
@@ -14,7 +14,7 @@ module GIGO
14
14
  private
15
15
 
16
16
  def self.detect_encoding(data)
17
- CharDet.detect(data.dup)['encoding']
17
+ GIGO::CharDet.detect(data.dup)['encoding']
18
18
  end
19
19
 
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module GIGO
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -11,6 +11,10 @@ module GIGO
11
11
  let(:data_bin_apos) { "won\x92t".force_encoding('binary') }
12
12
  let(:data_really_bad) { "ed.Ã\u0083Ã\u0083\xC3" }
13
13
 
14
+ let(:data_medico_utf8) { "Med\u00EDco".force_encoding('UTF-8') }
15
+ let(:data_medico_iso88591) { "Med\xEDco".force_encoding('iso8859-1') }
16
+ let(:data_medico_unknown) { "Med\uFFFDco".force_encoding('UTF-8') }
17
+
14
18
 
15
19
  describe '.encoding' do
16
20
 
@@ -42,7 +46,7 @@ module GIGO
42
46
  GIGO.load(data_bin_apos).must_equal "won’t"
43
47
  end
44
48
 
45
- it 'should allows properly encoded and marked strings to be passed thru' do
49
+ it 'should allow properly encoded and marked strings to be passed thru' do
46
50
  GIGO.load(data_utf8).must_equal data_utf8
47
51
  GIGO.load(data_utf8_emoji).must_equal data_utf8_emoji
48
52
  end
@@ -52,7 +56,11 @@ module GIGO
52
56
  end
53
57
 
54
58
  it 'allows really bad data to be encoded using default replace and question marks' do
55
- GIGO.load(data_utf8_emoji.force_encoding('ASCII-8BIT')).must_equal data_utf8_emoji
59
+ GIGO.load(data_medico_unknown).must_equal "Med�co"
60
+ end
61
+
62
+ it 'makes sure UTF-8 data read in as US-ASCII us fixed' do
63
+ GIGO.load(data_medico_utf8.force_encoding('US-ASCII')).must_equal 'Medíco'
56
64
  end
57
65
 
58
66
  it 'converts windows codepages that are poorly marked as another encoding' do
@@ -66,7 +74,12 @@ module GIGO
66
74
  GIGO.load(db_data4).must_equal data_utf8
67
75
  end
68
76
 
69
- it 'can make sure to it is really a valid encoding afteward' do
77
+ it 'converts iso8859 when poorly marked as another encoding' do
78
+ GIGO.load(data_medico_iso88591).must_equal 'Medíco'
79
+ GIGO.load(data_medico_iso88591.force_encoding('US-ASCII')).must_equal 'Medíco'
80
+ end
81
+
82
+ it 'can make sure to it is really a valid encoding afterward' do
70
83
  html_escape GIGO.load(data_really_bad)
71
84
  end
72
85
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gigo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -186,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  segments:
188
188
  - 0
189
- hash: -1915512776307670961
189
+ hash: 1872930804050042885
190
190
  required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  none: false
192
192
  requirements:
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  version: '0'
196
196
  segments:
197
197
  - 0
198
- hash: -1915512776307670961
198
+ hash: 1872930804050042885
199
199
  requirements: []
200
200
  rubyforge_project:
201
201
  rubygems_version: 1.8.25