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.
- data/gemfiles/activesupport30.gemfile.lock +1 -1
- data/gemfiles/activesupport31.gemfile.lock +1 -1
- data/gemfiles/activesupport32.gemfile.lock +1 -1
- data/gemfiles/activesupport40.gemfile.lock +1 -1
- data/lib/gigo/transcoders/rchardet.rb +1 -1
- data/lib/gigo/version.rb +1 -1
- data/test/cases/gigo_test.rb +16 -3
- metadata +3 -3
data/lib/gigo/version.rb
CHANGED
data/test/cases/gigo_test.rb
CHANGED
@@ -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
|
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(
|
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 '
|
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.
|
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:
|
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:
|
198
|
+
hash: 1872930804050042885
|
199
199
|
requirements: []
|
200
200
|
rubyforge_project:
|
201
201
|
rubygems_version: 1.8.25
|