utf8-cleaner 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 374bd095410578dc3d8cde50fee9d63fc4368c3a
4
- data.tar.gz: 69dc3e51d0697d179ae0f2f6170cd7d6b7767087
3
+ metadata.gz: 483d7ad030797ac6e4f59b23989e85cb02f8c871
4
+ data.tar.gz: ed06229b5cec24770bbfaba9c4586528a0f519a3
5
5
  SHA512:
6
- metadata.gz: 798c9c14ddca0d1e77796a24f2a5adb268dfe9f0e55a4664fe05b1d218aa02bf64d185e6ccb84174bd4329abd2ea6a2f03009b3c0d3fddb8e9754238cf4fe686
7
- data.tar.gz: c4553b88e53826bcf6b5f28019bb74b18b1f7cf6c6eb9db373144a9c355d56cb54021eb8a098c65a7d136605b52494dc099e8c2419a7526fd3b6ca83185d264e
6
+ metadata.gz: 80b2ec52b93bf99814b479d1059db52f8a8c507ee8df0434c29cc644ba93a65100573c1e4a3609f97a0bd94170cdad23bee0926064dc2e52d9c2d429d88c2635
7
+ data.tar.gz: 019d366a8de11b5c55625be6e4c19f3260d35d62e059b30111acc1cfc0c8fc5cd0c9c173e8003308a5fc6fc409305a6e3aaaa23066a172215cddb7f268238f62
@@ -21,6 +21,8 @@ module UTF8Cleaner
21
21
 
22
22
  def valid?
23
23
  valid_uri_encoded_utf8(data)
24
+ rescue Encoding::CompatibilityError
25
+ false
24
26
  end
25
27
 
26
28
  private
@@ -1,3 +1,3 @@
1
1
  module UTF8Cleaner
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -12,6 +12,7 @@ module UTF8Cleaner
12
12
  let(:no_byte_at_all) { URIString.new('%') }
13
13
  let(:not_even_hex_chars1) { URIString.new('%x') }
14
14
  let(:not_even_hex_chars2) { URIString.new('%0zhey') }
15
+ let(:mixed_encodings) { URIString.new('§%e2') }
15
16
 
16
17
  describe '#new' do
17
18
  it { expect(encoded_string).to be_a(URIString) }
@@ -26,6 +27,7 @@ module UTF8Cleaner
26
27
  it { expect(no_byte_at_all.cleaned).to eq('') }
27
28
  it { expect(not_even_hex_chars1.cleaned).to eq('') }
28
29
  it { expect(not_even_hex_chars2.cleaned).to eq('hey') }
30
+ it { expect(mixed_encodings.cleaned).to eq('§') }
29
31
  end
30
32
 
31
33
  describe '#valid?' do
@@ -38,6 +40,7 @@ module UTF8Cleaner
38
40
  it { expect(no_byte_at_all).to_not be_valid }
39
41
  it { expect(not_even_hex_chars1).to_not be_valid }
40
42
  it { expect(not_even_hex_chars2).to_not be_valid }
43
+ it { expect(mixed_encodings).to_not be_valid }
41
44
  end
42
45
 
43
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utf8-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leon Miller-Out
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-01 00:00:00.000000000 Z
11
+ date: 2016-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport