simpleidn 0.0.9 → 0.1.0

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: 91419f6658f1aa0e2efd5f1774879994f822a3d7
4
- data.tar.gz: 60663039b50c49baa983dc7d51179dae820d839d
3
+ metadata.gz: bce28ea85a51f76e2770f7ba4363fc4db912956c
4
+ data.tar.gz: bfd360e1657f1630fe90236109ad19c47eb3e0f9
5
5
  SHA512:
6
- metadata.gz: 1eca7fc205bdd66663334b91786029b645637d501acb8b61e8661b2298c751a2df39c4854b6f926f29dec505b5530f86c1159b7a3e0a6a8ffa4ef411fd59600d
7
- data.tar.gz: 5ca7274d2115e9e3a65f992721df2ec748719754e2ceccce3e03b1f4328c0a795a8fa85f90010d208fbb6f87d119b7f1154ae3d92e099b09d28957e0599e9a68
6
+ metadata.gz: 07e8c02135dcb9289e939812285b8a2bcacf730bb908907568d7fc0283dadc5ef94e2761bb3bceb37acbdef288513ce0d0a2297e3cf47b33650544b3f6854f06
7
+ data.tar.gz: 587b55c77c0ecb144f6b598591082b9c2a7ef5359268c0c9318fc3e2c5dbf2ac66d0a0c8eada17379c98ed60bbbee421774ec373652586899dbfb6cbc00b2c5f
data/.gitignore CHANGED
@@ -7,3 +7,5 @@ Gemfile.lock
7
7
  .rbenv-version
8
8
  doc
9
9
  spec/*.yml
10
+
11
+ coverage
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ cache: bundler
3
+ sudo: false
4
+ before_install:
5
+ - gem install bundler
6
+ rvm:
7
+ - 1.9.2
8
+ - 1.9.3
9
+ - 2.0
10
+ - 2.1
11
+ - 2.2
12
+ - jruby
13
+ script: 'bundle exec rspec spec/idn_spec.rb'
data/Gemfile CHANGED
@@ -1,3 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'simplecov', :require => false, :group => :test
4
+ gem 'codecov', :require => false, :group => :test
5
+ gem 'rspec', :require => false, :group => :test
6
+
3
7
  gemspec
@@ -1,5 +1,7 @@
1
1
  == SimpleIDN
2
2
 
3
+ {<img src="https://travis-ci.org/mmriis/simpleidn.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/mmriis/simpleidn]
4
+
3
5
  This gem allows easy conversion from punycode ACE strings to unicode UTF-8 strings and visa versa.
4
6
 
5
7
  The implementation is heavily based on the RFC3492 C example implementation but simplified since it does not preserve case.
@@ -1,5 +1,5 @@
1
1
  module SimpleIDN
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
 
4
4
  # The ConversionError is raised when an error occurs during a
5
5
  # Punycode <-> Unicode conversion.
@@ -228,6 +228,14 @@ module SimpleIDN
228
228
  domain_array.each do |s|
229
229
  out << (s.downcase.start_with?(ACE_PREFIX) ? Punycode.decode(s[ACE_PREFIX.length..-1]) : s)
230
230
  end
231
- out.join(DOT).encode(domain.encoding)
231
+ out = out.join(DOT)
232
+ # Try to convert to the input encoding, but don't error on failure
233
+ # Given that the input is plain 7-bit ASCII only, converting back
234
+ # frequently fails. We will try to allow UTF-16 and Unicode encodings
235
+ begin
236
+ out.encode!(domain.encoding)
237
+ rescue Encoding::UndefinedConversionError
238
+ end
239
+ out
232
240
  end
233
241
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simpleidn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morten Møller Riis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-14 00:00:00.000000000 Z
11
+ date: 2018-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,6 +61,7 @@ extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
63
  - ".gitignore"
64
+ - ".travis.yml"
64
65
  - Gemfile
65
66
  - LICENCE
66
67
  - README.rdoc
@@ -87,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
88
  version: '0'
88
89
  requirements: []
89
90
  rubyforge_project:
90
- rubygems_version: 2.5.1
91
+ rubygems_version: 2.2.2
91
92
  signing_key:
92
93
  specification_version: 4
93
94
  summary: Punycode ACE to unicode UTF-8 (and vice-versa) string conversion.