simpleidn 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENCE +21 -0
- data/Manifest +8 -0
- data/README.rdoc +37 -0
- data/Rakefile +13 -0
- data/lib/simpleidn.rb +252 -0
- data/simpleidn.gemspec +31 -0
- data/spec/idn.rb +22 -0
- data/spec/test_vectors.rb +138 -0
- data.tar.gz.sig +0 -0
- metadata +90 -0
- metadata.gz.sig +2 -0
data/LICENCE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2011 Morten Møller Riis
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/Manifest
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
== SimpleIDN
|
2
|
+
|
3
|
+
This gem allows easy conversion from punycode ACE strings to unicode UTF-8 strings and visa versa.
|
4
|
+
|
5
|
+
The implementation is heavily based on the RFC3492 C example implementation but simplified since it does not preserve case.
|
6
|
+
|
7
|
+
This gem works with both Ruby 1.8.7 and 1.9.2.
|
8
|
+
|
9
|
+
* http://www.whatastruggle.com
|
10
|
+
|
11
|
+
== Installation
|
12
|
+
|
13
|
+
[sudo] gem install simpleidn
|
14
|
+
|
15
|
+
+sudo+ is optional depending on your setup.
|
16
|
+
|
17
|
+
In your Ruby script you can now.
|
18
|
+
|
19
|
+
require 'rubygems'
|
20
|
+
require 'simpleidn'
|
21
|
+
|
22
|
+
SimpleIDN.to_unicode("xn--mllerriis-l8a.com")
|
23
|
+
=> "møllerriis.com"
|
24
|
+
|
25
|
+
SimpleIDN.to_ascii("møllerriis.com")
|
26
|
+
=> "xn--mllerriis-l8a.com"
|
27
|
+
|
28
|
+
== Testing / RSpec
|
29
|
+
|
30
|
+
In order to run the test suite you must have <tt>rspec</tt> installed.
|
31
|
+
|
32
|
+
The test suite has been copied from the IDN gem and uses examples from JOSEFSSON test vectors, taken from DRAFT-JOSEFSSON-IDN-TEST-VECTORS-00:
|
33
|
+
http://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html
|
34
|
+
|
35
|
+
== Known issues
|
36
|
+
|
37
|
+
None at the moment, but please report any issues!
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rake'
|
4
|
+
require 'echoe'
|
5
|
+
|
6
|
+
Echoe.new('simpleidn', '0.0.1') do |p|
|
7
|
+
p.description = "This gem allows easy conversion from punycode ACE strings to unicode UTF-8 strings and visa versa."
|
8
|
+
p.url = "http://github.com/mmriis/simpleidn"
|
9
|
+
p.author = "Morten Møller Riis"
|
10
|
+
p.email = "mortenmoellerriis _AT_ gmail.com"
|
11
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
12
|
+
end
|
13
|
+
|
data/lib/simpleidn.rb
ADDED
@@ -0,0 +1,252 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
if RUBY_VERSION =~ /^1\.8/
|
3
|
+
$KCODE = "UTF-8"
|
4
|
+
class String
|
5
|
+
def ord
|
6
|
+
self[0]
|
7
|
+
end
|
8
|
+
end
|
9
|
+
else
|
10
|
+
Encoding.default_internal = "UTF-8"
|
11
|
+
end
|
12
|
+
|
13
|
+
class Integer
|
14
|
+
def to_utf8_character
|
15
|
+
[self].pack("U*")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module SimpleIDN
|
20
|
+
|
21
|
+
module Punycode
|
22
|
+
|
23
|
+
INITIAL_N = 0x80
|
24
|
+
INITIAL_BIAS = 72
|
25
|
+
DELIMITER = 0x2D
|
26
|
+
BASE = 36
|
27
|
+
DAMP = 700
|
28
|
+
TMIN = 1
|
29
|
+
TMAX = 26
|
30
|
+
SKEW = 38
|
31
|
+
MAXINT = 0x7FFFFFFF
|
32
|
+
|
33
|
+
module_function
|
34
|
+
|
35
|
+
# decode_digit(cp) returns the numeric value of a basic code
|
36
|
+
# point (for use in representing integers) in the range 0 to
|
37
|
+
# base-1, or base if cp is does not represent a value.
|
38
|
+
def decode_digit(cp)
|
39
|
+
cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 : cp - 97 < 26 ? cp - 97 : BASE
|
40
|
+
end
|
41
|
+
|
42
|
+
# encode_digit(d,flag) returns the basic code point whose value
|
43
|
+
# (when used for representing integers) is d, which needs to be in
|
44
|
+
# the range 0 to base-1. The lowercase form is used unless flag is
|
45
|
+
# nonzero, in which case the uppercase form is used. The behavior
|
46
|
+
# is undefined if flag is nonzero and digit d has no uppercase form.
|
47
|
+
def encode_digit(d)
|
48
|
+
d + 22 + 75 * (d < 26 ? 1 : 0)
|
49
|
+
# 0..25 map to ASCII a..z or A..Z
|
50
|
+
# 26..35 map to ASCII 0..9
|
51
|
+
end
|
52
|
+
|
53
|
+
# Bias adaptation function
|
54
|
+
def adapt(delta, numpoints, firsttime)
|
55
|
+
delta = firsttime ? (delta / DAMP) : (delta >> 1)
|
56
|
+
delta += (delta / numpoints)
|
57
|
+
|
58
|
+
k = 0
|
59
|
+
while delta > (((BASE - TMIN) * TMAX) / 2) do
|
60
|
+
delta /= BASE - TMIN
|
61
|
+
k += BASE
|
62
|
+
end
|
63
|
+
return k + (BASE - TMIN + 1) * delta / (delta + SKEW)
|
64
|
+
end
|
65
|
+
|
66
|
+
# encode_basic(bcp,flag) forces a basic code point to lowercase if flag is zero,
|
67
|
+
# uppercase if flag is nonzero, and returns the resulting code point.
|
68
|
+
# The code point is unchanged if it is caseless.
|
69
|
+
# The behavior is undefined if bcp is not a basic code point.
|
70
|
+
def encode_basic(bcp, flag)
|
71
|
+
bcp -= (bcp - 97 < 26 ? 1 : 0) << 5
|
72
|
+
return bcp + ((!flag && (bcp - 65 < 26 ? 1 : 0)) << 5)
|
73
|
+
end
|
74
|
+
|
75
|
+
# Main decode
|
76
|
+
def decode(input)
|
77
|
+
output = []
|
78
|
+
|
79
|
+
# Initialize the state:
|
80
|
+
n = INITIAL_N
|
81
|
+
i = 0
|
82
|
+
bias = INITIAL_BIAS
|
83
|
+
|
84
|
+
# Handle the basic code points: Let basic be the number of input code
|
85
|
+
# points before the last delimiter, or 0 if there is none, then
|
86
|
+
# copy the first basic code points to the output.
|
87
|
+
basic = input.rindex(DELIMITER.to_utf8_character) || 0
|
88
|
+
|
89
|
+
input.unpack("U*")[0, basic].each do |char|
|
90
|
+
raise(RangeError, "Illegal input >= 0x80") if char >= 0x80
|
91
|
+
output << char.chr # to_utf8_character not needed her because ord < 0x80 (128) which is within US-ASCII.
|
92
|
+
end
|
93
|
+
|
94
|
+
# Main decoding loop: Start just after the last delimiter if any
|
95
|
+
# basic code points were copied; start at the beginning otherwise.
|
96
|
+
|
97
|
+
ic = basic > 0 ? basic + 1 : 0
|
98
|
+
while ic < input.length do
|
99
|
+
# ic is the index of the next character to be consumed,
|
100
|
+
|
101
|
+
# Decode a generalized variable-length integer into delta,
|
102
|
+
# which gets added to i. The overflow checking is easier
|
103
|
+
# if we increase i as we go, then subtract off its starting
|
104
|
+
# value at the end to obtain delta.
|
105
|
+
oldi = i
|
106
|
+
w = 1
|
107
|
+
k = BASE
|
108
|
+
while true do
|
109
|
+
raise(RangeError, "punycode_bad_input(1)") if ic >= input.length
|
110
|
+
|
111
|
+
digit = decode_digit(input[ic].ord)
|
112
|
+
ic += 1
|
113
|
+
|
114
|
+
raise(RangeError, "punycode_bad_input(2)") if digit >= BASE
|
115
|
+
|
116
|
+
raise(RangeError, "punycode_overflow(1)") if digit > (MAXINT - i) / w
|
117
|
+
|
118
|
+
i += digit * w
|
119
|
+
t = k <= bias ? TMIN : k >= bias + TMAX ? TMAX : k - bias
|
120
|
+
break if digit < t
|
121
|
+
raise(RangeError, "punycode_overflow(2)") if w > MAXINT / (BASE - t)
|
122
|
+
|
123
|
+
w *= BASE - t
|
124
|
+
k += BASE
|
125
|
+
end
|
126
|
+
|
127
|
+
out = output.length + 1
|
128
|
+
bias = adapt(i - oldi, out, oldi == 0)
|
129
|
+
|
130
|
+
# i was supposed to wrap around from out to 0,
|
131
|
+
# incrementing n each time, so we'll fix that now:
|
132
|
+
raise(RangeError, "punycode_overflow(3)") if (i / out) > MAXINT - n
|
133
|
+
|
134
|
+
n += (i / out)
|
135
|
+
i %= out
|
136
|
+
|
137
|
+
# Insert n at position i of the output:
|
138
|
+
output.insert(i, n.to_utf8_character)
|
139
|
+
i += 1
|
140
|
+
end
|
141
|
+
|
142
|
+
return output.join
|
143
|
+
end
|
144
|
+
|
145
|
+
# Main encode function
|
146
|
+
def encode(input)
|
147
|
+
|
148
|
+
input = input.downcase.unpack("U*")
|
149
|
+
output = []
|
150
|
+
|
151
|
+
# Initialize the state:
|
152
|
+
n = INITIAL_N
|
153
|
+
delta = 0
|
154
|
+
bias = INITIAL_BIAS
|
155
|
+
|
156
|
+
# Handle the basic code points:
|
157
|
+
output = input.select do |char|
|
158
|
+
char if char < 0x80
|
159
|
+
end
|
160
|
+
|
161
|
+
h = b = output.length
|
162
|
+
|
163
|
+
# h is the number of code points that have been handled, b is the
|
164
|
+
# number of basic code points
|
165
|
+
|
166
|
+
output << DELIMITER if b > 0
|
167
|
+
|
168
|
+
# Main encoding loop:
|
169
|
+
while h < input.length do
|
170
|
+
# All non-basic code points < n have been
|
171
|
+
# handled already. Find the next larger one:
|
172
|
+
|
173
|
+
m = MAXINT
|
174
|
+
|
175
|
+
input.each do |char|
|
176
|
+
m = char if char >= n && char < m
|
177
|
+
end
|
178
|
+
|
179
|
+
# Increase delta enough to advance the decoder's
|
180
|
+
# <n,i> state to <m,0>, but guard against overflow:
|
181
|
+
|
182
|
+
raise(RangeError, "punycode_overflow (1)") if m - n > ((MAXINT - delta) / (h + 1)).floor
|
183
|
+
|
184
|
+
delta += (m - n) * (h + 1)
|
185
|
+
n = m
|
186
|
+
|
187
|
+
input.each_with_index do |char, j|
|
188
|
+
if char < n
|
189
|
+
delta += 1
|
190
|
+
raise(StandardError,"punycode_overflow(2)") if delta > MAXINT
|
191
|
+
end
|
192
|
+
|
193
|
+
if (char == n)
|
194
|
+
# Represent delta as a generalized variable-length integer:
|
195
|
+
q = delta
|
196
|
+
k = BASE
|
197
|
+
while true do
|
198
|
+
t = k <= bias ? TMIN : k >= bias + TMAX ? TMAX : k - bias
|
199
|
+
break if q < t
|
200
|
+
output << encode_digit(t + (q - t) % (BASE - t))
|
201
|
+
q = ( (q - t) / (BASE - t) ).floor
|
202
|
+
k += BASE
|
203
|
+
end
|
204
|
+
output << encode_digit(q)
|
205
|
+
bias = adapt(delta, h + 1, h == b)
|
206
|
+
delta = 0
|
207
|
+
h += 1
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
delta += 1
|
212
|
+
n += 1
|
213
|
+
end
|
214
|
+
return output.collect {|c| c.to_utf8_character}.join
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
module_function
|
220
|
+
|
221
|
+
# Converts a UTF-8 unicode string to a punycode ACE string.
|
222
|
+
# == Example
|
223
|
+
# SimpleIDN.to_ascii("møllerriis.com")
|
224
|
+
# => "xn--mllerriis-l8a.com"
|
225
|
+
def to_ascii(domain)
|
226
|
+
domain_array = domain.split(".")
|
227
|
+
out = []
|
228
|
+
i = 0
|
229
|
+
while i < domain_array.length
|
230
|
+
s = domain_array[i]
|
231
|
+
out << (s =~ /[^A-Z0-9\-]/i ? "xn--" + Punycode.encode(s) : s)
|
232
|
+
i += 1
|
233
|
+
end
|
234
|
+
return out.join(".")
|
235
|
+
end
|
236
|
+
|
237
|
+
# Converts a punycode ACE string to a UTF-8 unicode string.
|
238
|
+
# == Example
|
239
|
+
# SimpleIDN.to_unicode("xn--mllerriis-l8a.com")
|
240
|
+
# => "møllerriis.com"
|
241
|
+
def to_unicode(domain)
|
242
|
+
domain_array = domain.split(".")
|
243
|
+
out = []
|
244
|
+
i = 0
|
245
|
+
while i < domain_array.length
|
246
|
+
s = domain_array[i]
|
247
|
+
out << (s =~ /^xn\-\-/i ? Punycode.decode(s.gsub('xn--','')) : s)
|
248
|
+
i += 1
|
249
|
+
end
|
250
|
+
return out.join(".")
|
251
|
+
end
|
252
|
+
end
|
data/simpleidn.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{simpleidn}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Morten Møller Riis"]
|
9
|
+
s.cert_chain = ["/Users/mmr/gem-public_cert.pem"]
|
10
|
+
s.date = %q{2011-05-09}
|
11
|
+
s.description = %q{This gem allows easy conversion from punycode ACE strings to unicode UTF-8 strings and visa versa.}
|
12
|
+
s.email = %q{mortenmoellerriis _AT_ gmail.com}
|
13
|
+
s.extra_rdoc_files = ["README.rdoc", "lib/simpleidn.rb"]
|
14
|
+
s.files = ["LICENCE", "Manifest", "README.rdoc", "Rakefile", "lib/simpleidn.rb", "simpleidn.gemspec", "spec/idn.rb", "spec/test_vectors.rb"]
|
15
|
+
s.homepage = %q{http://github.com/mmriis/simpleidn}
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Simpleidn", "--main", "README.rdoc"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{simpleidn}
|
19
|
+
s.rubygems_version = %q{1.6.2}
|
20
|
+
s.signing_key = %q{/Users/mmr/gem-private_key.pem}
|
21
|
+
s.summary = %q{This gem allows easy conversion from punycode ACE strings to unicode UTF-8 strings and visa versa.}
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
s.specification_version = 3
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
|
+
else
|
28
|
+
end
|
29
|
+
else
|
30
|
+
end
|
31
|
+
end
|
data/spec/idn.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rspec'
|
3
|
+
require 'simpleidn'
|
4
|
+
require 'test_vectors'
|
5
|
+
|
6
|
+
|
7
|
+
describe "SimpleIDN" do
|
8
|
+
describe "to_unicode" do
|
9
|
+
it "should pass all test cases" do
|
10
|
+
TESTCASES_JOSEFSSON.sort.each do |testcase, vector|
|
11
|
+
SimpleIDN.to_unicode(vector[1]).should == vector[0]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
describe "to_ascii" do
|
16
|
+
it "should pass all test cases" do
|
17
|
+
TESTCASES_JOSEFSSON.sort.each do |testcase, vector|
|
18
|
+
SimpleIDN.to_ascii(vector[0]) == vector[1]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# JOSEFSSON test vectors, taken from DRAFT-JOSEFSSON-IDN-TEST-VECTORS-00:
|
2
|
+
# http://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html
|
3
|
+
#
|
4
|
+
# Modifications:
|
5
|
+
# - omission of 5.20 since it is identical with 5.8 (case H below)
|
6
|
+
|
7
|
+
TESTCASES_JOSEFSSON = {
|
8
|
+
'A' => [
|
9
|
+
[ 0x0644, 0x064A, 0x0647, 0x0645, 0x0627, 0x0628, 0x062A, 0x0643,
|
10
|
+
0x0644, 0x0645, 0x0648, 0x0634, 0x0639, 0x0631, 0x0628, 0x064A,
|
11
|
+
0x061F ].pack('U*'),
|
12
|
+
'xn--egbpdaj6bu4bxfgehfvwxn'
|
13
|
+
],
|
14
|
+
|
15
|
+
'B' => [
|
16
|
+
[ 0x4ED6, 0x4EEC, 0x4E3A, 0x4EC0, 0x4E48, 0x4E0D, 0x8BF4, 0x4E2D,
|
17
|
+
0x6587 ].pack('U*'),
|
18
|
+
'xn--ihqwcrb4cv8a8dqg056pqjye'
|
19
|
+
],
|
20
|
+
|
21
|
+
'C' => [
|
22
|
+
[ 0x4ED6, 0x5011, 0x7232, 0x4EC0, 0x9EBD, 0x4E0D, 0x8AAA, 0x4E2D,
|
23
|
+
0x6587 ].pack('U*'),
|
24
|
+
'xn--ihqwctvzc91f659drss3x8bo0yb'
|
25
|
+
],
|
26
|
+
|
27
|
+
'D' => [
|
28
|
+
[ 0x0050, 0x0072, 0x006F, 0x010D, 0x0070, 0x0072, 0x006F, 0x0073,
|
29
|
+
0x0074, 0x011B, 0x006E, 0x0065, 0x006D, 0x006C, 0x0075, 0x0076,
|
30
|
+
0x00ED, 0x010D, 0x0065, 0x0073, 0x006B, 0x0079 ].pack('U*'),
|
31
|
+
'xn--Proprostnemluvesky-uyb24dma41a'
|
32
|
+
],
|
33
|
+
|
34
|
+
'E' => [
|
35
|
+
[ 0x05DC, 0x05DE, 0x05D4, 0x05D4, 0x05DD, 0x05E4, 0x05E9, 0x05D5,
|
36
|
+
0x05D8, 0x05DC, 0x05D0, 0x05DE, 0x05D3, 0x05D1, 0x05E8, 0x05D9,
|
37
|
+
0x05DD, 0x05E2, 0x05D1, 0x05E8, 0x05D9, 0x05EA ].pack('U*'),
|
38
|
+
'xn--4dbcagdahymbxekheh6e0a7fei0b'
|
39
|
+
],
|
40
|
+
|
41
|
+
'F' => [
|
42
|
+
[ 0x092F, 0x0939, 0x0932, 0x094B, 0x0917, 0x0939, 0x093F, 0x0928,
|
43
|
+
0x094D, 0x0926, 0x0940, 0x0915, 0x094D, 0x092F, 0x094B, 0x0902,
|
44
|
+
0x0928, 0x0939, 0x0940, 0x0902, 0x092C, 0x094B, 0x0932, 0x0938,
|
45
|
+
0x0915, 0x0924, 0x0947, 0x0939, 0x0948, 0x0902 ].pack('U*'),
|
46
|
+
'xn--i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd'
|
47
|
+
],
|
48
|
+
|
49
|
+
'G' => [
|
50
|
+
[ 0x306A, 0x305C, 0x307F, 0x3093, 0x306A, 0x65E5, 0x672C, 0x8A9E,
|
51
|
+
0x3092, 0x8A71, 0x3057, 0x3066, 0x304F, 0x308C, 0x306A, 0x3044,
|
52
|
+
0x306E, 0x304B ].pack('U*'),
|
53
|
+
'xn--n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa'
|
54
|
+
],
|
55
|
+
|
56
|
+
'H' => [
|
57
|
+
[ 0x043F, 0x043E, 0x0447, 0x0435, 0x043C, 0x0443, 0x0436, 0x0435,
|
58
|
+
0x043E, 0x043D, 0x0438, 0x043D, 0x0435, 0x0433, 0x043E, 0x0432,
|
59
|
+
0x043E, 0x0440, 0x044F, 0x0442, 0x043F, 0x043E, 0x0440, 0x0443,
|
60
|
+
0x0441, 0x0441, 0x043A, 0x0438 ].pack('U*'),
|
61
|
+
'xn--b1abfaaepdrnnbgefbadotcwatmq2g4l'
|
62
|
+
],
|
63
|
+
|
64
|
+
'I' => [
|
65
|
+
[ 0x0050, 0x006F, 0x0072, 0x0071, 0x0075, 0x00E9, 0x006E, 0x006F,
|
66
|
+
0x0070, 0x0075, 0x0065, 0x0064, 0x0065, 0x006E, 0x0073, 0x0069,
|
67
|
+
0x006D, 0x0070, 0x006C, 0x0065, 0x006D, 0x0065, 0x006E, 0x0074,
|
68
|
+
0x0065, 0x0068, 0x0061, 0x0062, 0x006C, 0x0061, 0x0072, 0x0065,
|
69
|
+
0x006E, 0x0045, 0x0073, 0x0070, 0x0061, 0x00F1, 0x006F,
|
70
|
+
0x006C ].pack('U*'),
|
71
|
+
'xn--PorqunopuedensimplementehablarenEspaol-fmd56a'
|
72
|
+
],
|
73
|
+
|
74
|
+
'J' => [
|
75
|
+
[ 0x0054, 0x1EA1, 0x0069, 0x0073, 0x0061, 0x006F, 0x0068, 0x1ECD,
|
76
|
+
0x006B, 0x0068, 0x00F4, 0x006E, 0x0067, 0x0074, 0x0068, 0x1EC3,
|
77
|
+
0x0063, 0x0068, 0x1EC9, 0x006E, 0x00F3, 0x0069, 0x0074, 0x0069,
|
78
|
+
0x1EBF, 0x006E, 0x0067, 0x0056, 0x0069, 0x1EC7, 0x0074 ].pack('U*'),
|
79
|
+
'xn--TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g'
|
80
|
+
],
|
81
|
+
|
82
|
+
'K' => [
|
83
|
+
[ 0x0033, 0x5E74, 0x0042, 0x7D44, 0x91D1, 0x516B, 0x5148,
|
84
|
+
0x751F ].pack('U*'),
|
85
|
+
'xn--3B-ww4c5e180e575a65lsy2b'
|
86
|
+
],
|
87
|
+
|
88
|
+
'L' => [
|
89
|
+
[ 0x5B89, 0x5BA4, 0x5948, 0x7F8E, 0x6075, 0x002D, 0x0077, 0x0069,
|
90
|
+
0x0074, 0x0068, 0x002D, 0x0053, 0x0055, 0x0050, 0x0045, 0x0052,
|
91
|
+
0x002D, 0x004D, 0x004F, 0x004E, 0x004B, 0x0045, 0x0059,
|
92
|
+
0x0053 ].pack('U*'),
|
93
|
+
'xn---with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n'
|
94
|
+
],
|
95
|
+
|
96
|
+
'M' => [
|
97
|
+
[ 0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x002D, 0x0041, 0x006E,
|
98
|
+
0x006F, 0x0074, 0x0068, 0x0065, 0x0072, 0x002D, 0x0057, 0x0061,
|
99
|
+
0x0079, 0x002D, 0x305D, 0x308C, 0x305E, 0x308C, 0x306E, 0x5834,
|
100
|
+
0x6240 ].pack('U*'),
|
101
|
+
'xn--Hello-Another-Way--fc4qua05auwb3674vfr0b'
|
102
|
+
],
|
103
|
+
|
104
|
+
'N' => [
|
105
|
+
[ 0x3072, 0x3068, 0x3064, 0x5C4B, 0x6839, 0x306E, 0x4E0B,
|
106
|
+
0x0032 ].pack('U*'),
|
107
|
+
'xn--2-u9tlzr9756bt3uc0v'
|
108
|
+
],
|
109
|
+
|
110
|
+
'O' => [
|
111
|
+
[ 0x004D, 0x0061, 0x006A, 0x0069, 0x3067, 0x004B, 0x006F, 0x0069,
|
112
|
+
0x3059, 0x308B, 0x0035, 0x79D2, 0x524D ].pack('U*'),
|
113
|
+
'xn--MajiKoi5-783gue6qz075azm5e'
|
114
|
+
],
|
115
|
+
|
116
|
+
'P' => [
|
117
|
+
[ 0x30D1, 0x30D5, 0x30A3, 0x30FC, 0x0064, 0x0065, 0x30EB, 0x30F3,
|
118
|
+
0x30D0 ].pack('U*'),
|
119
|
+
'xn--de-jg4avhby1noc0d'
|
120
|
+
],
|
121
|
+
|
122
|
+
'Q' => [
|
123
|
+
[ 0x305D, 0x306E, 0x30B9, 0x30D4, 0x30FC, 0x30C9, 0x3067 ].pack('U*'),
|
124
|
+
'xn--d9juau41awczczp'
|
125
|
+
],
|
126
|
+
|
127
|
+
'R' => [
|
128
|
+
[ 0x03B5, 0x03BB, 0x03BB, 0x03B7, 0x03BD, 0x03B9, 0x03BA,
|
129
|
+
0x03AC ].pack('U*'),
|
130
|
+
'xn--hxargifdar'
|
131
|
+
],
|
132
|
+
|
133
|
+
'S' => [
|
134
|
+
[ 0x0062, 0x006F, 0x006E, 0x0121, 0x0075, 0x0073, 0x0061, 0x0127,
|
135
|
+
0x0127, 0x0061 ].pack('U*'),
|
136
|
+
'xn--bonusaa-5bb1da'
|
137
|
+
]
|
138
|
+
}
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simpleidn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- "Morten M\xC3\xB8ller Riis"
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain:
|
12
|
+
- |
|
13
|
+
-----BEGIN CERTIFICATE-----
|
14
|
+
MIIDRDCCAiygAwIBAgIBADANBgkqhkiG9w0BAQUFADBIMRowGAYDVQQDDBFtb3J0
|
15
|
+
ZW5tb2VsbGVycmlpczEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPy
|
16
|
+
LGQBGRYDY29tMB4XDTEwMTIwNjEzMTQ0NloXDTExMTIwNjEzMTQ0NlowSDEaMBgG
|
17
|
+
A1UEAwwRbW9ydGVubW9lbGxlcnJpaXMxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDET
|
18
|
+
MBEGCgmSJomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
19
|
+
ggEBAKtTB3aT+LG2jPkb7hfGKTpyizK6MdOZmnt2xv3dlfA+aPnpliY3QccdJE3R
|
20
|
+
d9nNHOaQ1rrCuhBBpZu/q7nuGD8ZuMxPcqYriBzfeUv2Nsgc2XXKp9E0UIpkuxf2
|
21
|
+
Xkv26iWI7sYDzS0pCtu2of6Zw9GyVDVmB8Zf/xYQjDHDZZF6qNAVFTYvnAdl+qxb
|
22
|
+
1VQmOmzVszc33Ic9ZtJ896QjtBPUf82FIbEYz3uy75KwDfKHM4AS85wtWEFDL0Qt
|
23
|
+
FXGlxmq3DkNKmTPrfQ/+i2Oy8JB+OdY9ZMDsOKS17LJh+CsadQNXrp1WvZgxgo/1
|
24
|
+
HfsXb1m+lPZZIuN3WgKCDQMAxqECAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8E
|
25
|
+
BAMCBLAwHQYDVR0OBBYEFFhp4owxGE1Gv7NPEdw7gyx6YfozMA0GCSqGSIb3DQEB
|
26
|
+
BQUAA4IBAQAr/Vq+06hYH60Tldjc2ikzFP4q3NbMjwEMarlZTnNFXsjjNJP6uzJu
|
27
|
+
8MV7ti/sslVKe82HUcrvFpMng2RsDHWt9YwPgWR/px8dyKoaZf1CjSf4O/qS317N
|
28
|
+
atSQvqSu+4cg5hpA87d0YIAeIEsEfWJuxmQ1jk/2Bsn/HQbLPE3vcGHF14H3U+O6
|
29
|
+
QYZoEtohq7CjW3fqKvQ7l2/fIFiMj8vTxdualWXX0RoF3QRKIuonpaYkDO+CrLoX
|
30
|
+
dDGWqJ1r5VRKULVNTLI6XwS0AbB93CaACN5AVFdhKOZNU1M0L4zyGWF9GMQfY74N
|
31
|
+
Pv5fihHPGcYA3voHCFu2/KGlBiF8TBQ6
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
|
34
|
+
date: 2011-05-09 00:00:00 +02:00
|
35
|
+
default_executable:
|
36
|
+
dependencies: []
|
37
|
+
|
38
|
+
description: This gem allows easy conversion from punycode ACE strings to unicode UTF-8 strings and visa versa.
|
39
|
+
email: mortenmoellerriis _AT_ gmail.com
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files:
|
45
|
+
- README.rdoc
|
46
|
+
- lib/simpleidn.rb
|
47
|
+
files:
|
48
|
+
- LICENCE
|
49
|
+
- Manifest
|
50
|
+
- README.rdoc
|
51
|
+
- Rakefile
|
52
|
+
- lib/simpleidn.rb
|
53
|
+
- simpleidn.gemspec
|
54
|
+
- spec/idn.rb
|
55
|
+
- spec/test_vectors.rb
|
56
|
+
has_rdoc: true
|
57
|
+
homepage: http://github.com/mmriis/simpleidn
|
58
|
+
licenses: []
|
59
|
+
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options:
|
62
|
+
- --line-numbers
|
63
|
+
- --inline-source
|
64
|
+
- --title
|
65
|
+
- Simpleidn
|
66
|
+
- --main
|
67
|
+
- README.rdoc
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: "0"
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: "1.2"
|
82
|
+
requirements: []
|
83
|
+
|
84
|
+
rubyforge_project: simpleidn
|
85
|
+
rubygems_version: 1.6.2
|
86
|
+
signing_key:
|
87
|
+
specification_version: 3
|
88
|
+
summary: This gem allows easy conversion from punycode ACE strings to unicode UTF-8 strings and visa versa.
|
89
|
+
test_files: []
|
90
|
+
|
metadata.gz.sig
ADDED