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 +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +13 -0
- data/Gemfile +4 -0
- data/README.rdoc +2 -0
- data/lib/simpleidn.rb +10 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bce28ea85a51f76e2770f7ba4363fc4db912956c
|
4
|
+
data.tar.gz: bfd360e1657f1630fe90236109ad19c47eb3e0f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07e8c02135dcb9289e939812285b8a2bcacf730bb908907568d7fc0283dadc5ef94e2761bb3bceb37acbdef288513ce0d0a2297e3cf47b33650544b3f6854f06
|
7
|
+
data.tar.gz: 587b55c77c0ecb144f6b598591082b9c2a7ef5359268c0c9318fc3e2c5dbf2ac66d0a0c8eada17379c98ed60bbbee421774ec373652586899dbfb6cbc00b2c5f
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -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.
|
data/lib/simpleidn.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module SimpleIDN
|
2
|
-
VERSION = "0.0
|
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)
|
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
|
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:
|
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.
|
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.
|