simpleidn 0.1.1 → 0.2.3
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.
- checksums.yaml +5 -5
- data/.travis.yml +5 -9
- data/LICENCE +1 -1
- data/README.rdoc +3 -5
- data/lib/simpleidn/uts46mapping.rb +274 -7
- data/lib/simpleidn/version.rb +1 -1
- data/lib/simpleidn.rb +1 -2
- data/simpleidn.gemspec +3 -6
- data/tables/IdnaMappingTable.txt +822 -147
- metadata +9 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bc28e3f1151e0c2355f2e74c9d86c2a4d3df9a3154ceec4b6e5d40c59e47f9a3
|
4
|
+
data.tar.gz: 294aeff28e2d897eb97e311d5758449ea474ad82d08ef421ddd5276464379e51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 688866028bccaeb4a80d863a020f7c0604575a60532c8fd2dc99780e6a3b9e7a1213dad7f2cab2533e8c78a947ce6ae029570b9394fbe30d9a1970779b074f35
|
7
|
+
data.tar.gz: a105c8a6ecd3f25fe3253c789896011c487567a9ed4fabf529f6080f7ef648343e0592fd4440d6edbe9423d0263ee30d0aa9a602d3618b83f1b67a3a1656fa66
|
data/.travis.yml
CHANGED
data/LICENCE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2011-
|
3
|
+
Copyright (c) 2011-2024 Morten Møller Riis
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.rdoc
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
== SimpleIDN
|
2
2
|
|
3
|
-
{
|
3
|
+
{rdoc-image:https://app.travis-ci.com/mmriis/simpleidn.svg?branch=master}[https://app.travis-ci.com/mmriis/simpleidn]
|
4
4
|
|
5
5
|
This gem allows easy conversion from punycode ACE strings to unicode UTF-8 strings and visa versa.
|
6
6
|
|
7
7
|
The implementation is heavily based on the RFC3492 C example implementation but simplified since it does not preserve case.
|
8
8
|
|
9
|
-
This gem works with Ruby
|
10
|
-
|
11
|
-
* http://www.whatastruggle.com
|
9
|
+
This gem works with Ruby 2.2+.
|
12
10
|
|
13
11
|
== Installation
|
14
12
|
|
@@ -24,7 +22,7 @@ In your Ruby script you can now.
|
|
24
22
|
SimpleIDN.to_unicode("xn--mllerriis-l8a.com")
|
25
23
|
=> "møllerriis.com"
|
26
24
|
|
27
|
-
|
25
|
+
SimpleIDN.to_ascii("møllerriis.com")
|
28
26
|
=> "xn--mllerriis-l8a.com"
|
29
27
|
|
30
28
|
== Testing / RSpec
|
@@ -1,13 +1,16 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
# IdnaMappingTable
|
4
|
-
# Date:
|
5
|
-
# ©
|
3
|
+
# IdnaMappingTable.txt
|
4
|
+
# Date: 2023-08-10, 22:32:27 GMT
|
5
|
+
# © 2023 Unicode®, Inc.
|
6
6
|
# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries.
|
7
|
-
# For terms of use, see
|
7
|
+
# For terms of use, see https://www.unicode.org/terms_of_use.html
|
8
|
+
#
|
9
|
+
# Unicode IDNA Compatible Preprocessing for UTS #46
|
10
|
+
# Version: 15.1.0
|
11
|
+
#
|
12
|
+
# For documentation and usage, see https://www.unicode.org/reports/tr46
|
8
13
|
#
|
9
|
-
# Unicode IDNA Compatible Preprocessing (UTS #46)
|
10
|
-
# For documentation, see http://www.unicode.org/reports/tr46/
|
11
14
|
# Total code points: 1114112
|
12
15
|
|
13
16
|
module SimpleIDN
|
@@ -606,6 +609,7 @@ module SimpleIDN
|
|
606
609
|
6155 => [],
|
607
610
|
6156 => [],
|
608
611
|
6157 => [],
|
612
|
+
6159 => [],
|
609
613
|
7296 => 1074,
|
610
614
|
7297 => 1076,
|
611
615
|
7298 => 1086,
|
@@ -615,6 +619,52 @@ module SimpleIDN
|
|
615
619
|
7302 => 1098,
|
616
620
|
7303 => 1123,
|
617
621
|
7304 => 42571,
|
622
|
+
7312 => 4304,
|
623
|
+
7313 => 4305,
|
624
|
+
7314 => 4306,
|
625
|
+
7315 => 4307,
|
626
|
+
7316 => 4308,
|
627
|
+
7317 => 4309,
|
628
|
+
7318 => 4310,
|
629
|
+
7319 => 4311,
|
630
|
+
7320 => 4312,
|
631
|
+
7321 => 4313,
|
632
|
+
7322 => 4314,
|
633
|
+
7323 => 4315,
|
634
|
+
7324 => 4316,
|
635
|
+
7325 => 4317,
|
636
|
+
7326 => 4318,
|
637
|
+
7327 => 4319,
|
638
|
+
7328 => 4320,
|
639
|
+
7329 => 4321,
|
640
|
+
7330 => 4322,
|
641
|
+
7331 => 4323,
|
642
|
+
7332 => 4324,
|
643
|
+
7333 => 4325,
|
644
|
+
7334 => 4326,
|
645
|
+
7335 => 4327,
|
646
|
+
7336 => 4328,
|
647
|
+
7337 => 4329,
|
648
|
+
7338 => 4330,
|
649
|
+
7339 => 4331,
|
650
|
+
7340 => 4332,
|
651
|
+
7341 => 4333,
|
652
|
+
7342 => 4334,
|
653
|
+
7343 => 4335,
|
654
|
+
7344 => 4336,
|
655
|
+
7345 => 4337,
|
656
|
+
7346 => 4338,
|
657
|
+
7347 => 4339,
|
658
|
+
7348 => 4340,
|
659
|
+
7349 => 4341,
|
660
|
+
7350 => 4342,
|
661
|
+
7351 => 4343,
|
662
|
+
7352 => 4344,
|
663
|
+
7353 => 4345,
|
664
|
+
7354 => 4346,
|
665
|
+
7357 => 4349,
|
666
|
+
7358 => 4350,
|
667
|
+
7359 => 4351,
|
618
668
|
7468 => 97,
|
619
669
|
7469 => 230,
|
620
670
|
7470 => 98,
|
@@ -790,7 +840,7 @@ module SimpleIDN
|
|
790
840
|
7828 => 7829,
|
791
841
|
7834 => [97, 702],
|
792
842
|
7835 => 7777,
|
793
|
-
7838 =>
|
843
|
+
7838 => 223,
|
794
844
|
7840 => 7841,
|
795
845
|
7842 => 7843,
|
796
846
|
7844 => 7845,
|
@@ -1349,6 +1399,7 @@ module SimpleIDN
|
|
1349
1399
|
11308 => 11356,
|
1350
1400
|
11309 => 11357,
|
1351
1401
|
11310 => 11358,
|
1402
|
+
11311 => 11359,
|
1352
1403
|
11360 => 11361,
|
1353
1404
|
11362 => 619,
|
1354
1405
|
11363 => 7549,
|
@@ -1998,6 +2049,7 @@ module SimpleIDN
|
|
1998
2049
|
13052 => 12528,
|
1999
2050
|
13053 => 12529,
|
2000
2051
|
13054 => 12530,
|
2052
|
+
13055 => [20196, 21644],
|
2001
2053
|
13056 => [12450, 12497, 12540, 12488],
|
2002
2054
|
13057 => [12450, 12523, 12501, 12449],
|
2003
2055
|
13058 => [12450, 12531, 12506, 12450],
|
@@ -2362,12 +2414,31 @@ module SimpleIDN
|
|
2362
2414
|
42931 => 43859,
|
2363
2415
|
42932 => 42933,
|
2364
2416
|
42934 => 42935,
|
2417
|
+
42936 => 42937,
|
2418
|
+
42938 => 42939,
|
2419
|
+
42940 => 42941,
|
2420
|
+
42942 => 42943,
|
2421
|
+
42944 => 42945,
|
2422
|
+
42946 => 42947,
|
2423
|
+
42948 => 42900,
|
2424
|
+
42949 => 642,
|
2425
|
+
42950 => 7566,
|
2426
|
+
42951 => 42952,
|
2427
|
+
42953 => 42954,
|
2428
|
+
42960 => 42961,
|
2429
|
+
42966 => 42967,
|
2430
|
+
42968 => 42969,
|
2431
|
+
42994 => 99,
|
2432
|
+
42995 => 102,
|
2433
|
+
42996 => 113,
|
2434
|
+
42997 => 42998,
|
2365
2435
|
43000 => 295,
|
2366
2436
|
43001 => 339,
|
2367
2437
|
43868 => 42791,
|
2368
2438
|
43869 => 43831,
|
2369
2439
|
43870 => 619,
|
2370
2440
|
43871 => 43858,
|
2441
|
+
43881 => 653,
|
2371
2442
|
43888 => 5024,
|
2372
2443
|
43889 => 5025,
|
2373
2444
|
43890 => 5026,
|
@@ -4075,6 +4146,97 @@ module SimpleIDN
|
|
4075
4146
|
66769 => 66809,
|
4076
4147
|
66770 => 66810,
|
4077
4148
|
66771 => 66811,
|
4149
|
+
66928 => 66967,
|
4150
|
+
66929 => 66968,
|
4151
|
+
66930 => 66969,
|
4152
|
+
66931 => 66970,
|
4153
|
+
66932 => 66971,
|
4154
|
+
66933 => 66972,
|
4155
|
+
66934 => 66973,
|
4156
|
+
66935 => 66974,
|
4157
|
+
66936 => 66975,
|
4158
|
+
66937 => 66976,
|
4159
|
+
66938 => 66977,
|
4160
|
+
66940 => 66979,
|
4161
|
+
66941 => 66980,
|
4162
|
+
66942 => 66981,
|
4163
|
+
66943 => 66982,
|
4164
|
+
66944 => 66983,
|
4165
|
+
66945 => 66984,
|
4166
|
+
66946 => 66985,
|
4167
|
+
66947 => 66986,
|
4168
|
+
66948 => 66987,
|
4169
|
+
66949 => 66988,
|
4170
|
+
66950 => 66989,
|
4171
|
+
66951 => 66990,
|
4172
|
+
66952 => 66991,
|
4173
|
+
66953 => 66992,
|
4174
|
+
66954 => 66993,
|
4175
|
+
66956 => 66995,
|
4176
|
+
66957 => 66996,
|
4177
|
+
66958 => 66997,
|
4178
|
+
66959 => 66998,
|
4179
|
+
66960 => 66999,
|
4180
|
+
66961 => 67000,
|
4181
|
+
66962 => 67001,
|
4182
|
+
66964 => 67003,
|
4183
|
+
66965 => 67004,
|
4184
|
+
67457 => 720,
|
4185
|
+
67458 => 721,
|
4186
|
+
67459 => 230,
|
4187
|
+
67460 => 665,
|
4188
|
+
67461 => 595,
|
4189
|
+
67463 => 675,
|
4190
|
+
67464 => 43878,
|
4191
|
+
67465 => 677,
|
4192
|
+
67466 => 676,
|
4193
|
+
67467 => 598,
|
4194
|
+
67468 => 599,
|
4195
|
+
67469 => 7569,
|
4196
|
+
67470 => 600,
|
4197
|
+
67471 => 606,
|
4198
|
+
67472 => 681,
|
4199
|
+
67473 => 612,
|
4200
|
+
67474 => 610,
|
4201
|
+
67475 => 608,
|
4202
|
+
67476 => 667,
|
4203
|
+
67477 => 295,
|
4204
|
+
67478 => 668,
|
4205
|
+
67479 => 615,
|
4206
|
+
67480 => 644,
|
4207
|
+
67481 => 682,
|
4208
|
+
67482 => 683,
|
4209
|
+
67483 => 620,
|
4210
|
+
67484 => 122628,
|
4211
|
+
67485 => 42894,
|
4212
|
+
67486 => 622,
|
4213
|
+
67487 => 122629,
|
4214
|
+
67488 => 654,
|
4215
|
+
67489 => 122630,
|
4216
|
+
67490 => 248,
|
4217
|
+
67491 => 630,
|
4218
|
+
67492 => 631,
|
4219
|
+
67493 => 113,
|
4220
|
+
67494 => 634,
|
4221
|
+
67495 => 122632,
|
4222
|
+
67496 => 637,
|
4223
|
+
67497 => 638,
|
4224
|
+
67498 => 640,
|
4225
|
+
67499 => 680,
|
4226
|
+
67500 => 678,
|
4227
|
+
67501 => 43879,
|
4228
|
+
67502 => 679,
|
4229
|
+
67503 => 648,
|
4230
|
+
67504 => 11377,
|
4231
|
+
67506 => 655,
|
4232
|
+
67507 => 673,
|
4233
|
+
67508 => 674,
|
4234
|
+
67509 => 664,
|
4235
|
+
67510 => 448,
|
4236
|
+
67511 => 449,
|
4237
|
+
67512 => 450,
|
4238
|
+
67513 => 122634,
|
4239
|
+
67514 => 122654,
|
4078
4240
|
68736 => 68800,
|
4079
4241
|
68737 => 68801,
|
4080
4242
|
68738 => 68802,
|
@@ -4158,6 +4320,38 @@ module SimpleIDN
|
|
4158
4320
|
71869 => 71901,
|
4159
4321
|
71870 => 71902,
|
4160
4322
|
71871 => 71903,
|
4323
|
+
93760 => 93792,
|
4324
|
+
93761 => 93793,
|
4325
|
+
93762 => 93794,
|
4326
|
+
93763 => 93795,
|
4327
|
+
93764 => 93796,
|
4328
|
+
93765 => 93797,
|
4329
|
+
93766 => 93798,
|
4330
|
+
93767 => 93799,
|
4331
|
+
93768 => 93800,
|
4332
|
+
93769 => 93801,
|
4333
|
+
93770 => 93802,
|
4334
|
+
93771 => 93803,
|
4335
|
+
93772 => 93804,
|
4336
|
+
93773 => 93805,
|
4337
|
+
93774 => 93806,
|
4338
|
+
93775 => 93807,
|
4339
|
+
93776 => 93808,
|
4340
|
+
93777 => 93809,
|
4341
|
+
93778 => 93810,
|
4342
|
+
93779 => 93811,
|
4343
|
+
93780 => 93812,
|
4344
|
+
93781 => 93813,
|
4345
|
+
93782 => 93814,
|
4346
|
+
93783 => 93815,
|
4347
|
+
93784 => 93816,
|
4348
|
+
93785 => 93817,
|
4349
|
+
93786 => 93818,
|
4350
|
+
93787 => 93819,
|
4351
|
+
93788 => 93820,
|
4352
|
+
93789 => 93821,
|
4353
|
+
93790 => 93822,
|
4354
|
+
93791 => 93823,
|
4161
4355
|
113824 => [],
|
4162
4356
|
113825 => [],
|
4163
4357
|
113826 => [],
|
@@ -5171,6 +5365,68 @@ module SimpleIDN
|
|
5171
5365
|
120829 => 55,
|
5172
5366
|
120830 => 56,
|
5173
5367
|
120831 => 57,
|
5368
|
+
122928 => 1072,
|
5369
|
+
122929 => 1073,
|
5370
|
+
122930 => 1074,
|
5371
|
+
122931 => 1075,
|
5372
|
+
122932 => 1076,
|
5373
|
+
122933 => 1077,
|
5374
|
+
122934 => 1078,
|
5375
|
+
122935 => 1079,
|
5376
|
+
122936 => 1080,
|
5377
|
+
122937 => 1082,
|
5378
|
+
122938 => 1083,
|
5379
|
+
122939 => 1084,
|
5380
|
+
122940 => 1086,
|
5381
|
+
122941 => 1087,
|
5382
|
+
122942 => 1088,
|
5383
|
+
122943 => 1089,
|
5384
|
+
122944 => 1090,
|
5385
|
+
122945 => 1091,
|
5386
|
+
122946 => 1092,
|
5387
|
+
122947 => 1093,
|
5388
|
+
122948 => 1094,
|
5389
|
+
122949 => 1095,
|
5390
|
+
122950 => 1096,
|
5391
|
+
122951 => 1099,
|
5392
|
+
122952 => 1101,
|
5393
|
+
122953 => 1102,
|
5394
|
+
122954 => 42633,
|
5395
|
+
122955 => 1241,
|
5396
|
+
122956 => 1110,
|
5397
|
+
122957 => 1112,
|
5398
|
+
122958 => 1257,
|
5399
|
+
122959 => 1199,
|
5400
|
+
122960 => 1231,
|
5401
|
+
122961 => 1072,
|
5402
|
+
122962 => 1073,
|
5403
|
+
122963 => 1074,
|
5404
|
+
122964 => 1075,
|
5405
|
+
122965 => 1076,
|
5406
|
+
122966 => 1077,
|
5407
|
+
122967 => 1078,
|
5408
|
+
122968 => 1079,
|
5409
|
+
122969 => 1080,
|
5410
|
+
122970 => 1082,
|
5411
|
+
122971 => 1083,
|
5412
|
+
122972 => 1086,
|
5413
|
+
122973 => 1087,
|
5414
|
+
122974 => 1089,
|
5415
|
+
122975 => 1091,
|
5416
|
+
122976 => 1092,
|
5417
|
+
122977 => 1093,
|
5418
|
+
122978 => 1094,
|
5419
|
+
122979 => 1095,
|
5420
|
+
122980 => 1096,
|
5421
|
+
122981 => 1098,
|
5422
|
+
122982 => 1099,
|
5423
|
+
122983 => 1169,
|
5424
|
+
122984 => 1110,
|
5425
|
+
122985 => 1109,
|
5426
|
+
122986 => 1119,
|
5427
|
+
122987 => 1195,
|
5428
|
+
122988 => 42577,
|
5429
|
+
122989 => 1201,
|
5174
5430
|
125184 => 125218,
|
5175
5431
|
125185 => 125219,
|
5176
5432
|
125186 => 125220,
|
@@ -5421,6 +5677,7 @@ module SimpleIDN
|
|
5421
5677
|
127311 => [119, 99],
|
5422
5678
|
127338 => [109, 99],
|
5423
5679
|
127339 => [109, 100],
|
5680
|
+
127340 => [109, 114],
|
5424
5681
|
127376 => [100, 106],
|
5425
5682
|
127488 => [12411, 12363],
|
5426
5683
|
127489 => [12467, 12467],
|
@@ -5480,6 +5737,16 @@ module SimpleIDN
|
|
5480
5737
|
127560 => [12308, 25943, 12309],
|
5481
5738
|
127568 => 24471,
|
5482
5739
|
127569 => 21487,
|
5740
|
+
130032 => 48,
|
5741
|
+
130033 => 49,
|
5742
|
+
130034 => 50,
|
5743
|
+
130035 => 51,
|
5744
|
+
130036 => 52,
|
5745
|
+
130037 => 53,
|
5746
|
+
130038 => 54,
|
5747
|
+
130039 => 55,
|
5748
|
+
130040 => 56,
|
5749
|
+
130041 => 57,
|
5483
5750
|
194560 => 20029,
|
5484
5751
|
194561 => 20024,
|
5485
5752
|
194562 => 20033,
|
data/lib/simpleidn/version.rb
CHANGED
data/lib/simpleidn.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'simpleidn/version'
|
2
2
|
require 'simpleidn/uts46mapping'
|
3
|
-
require 'unf'
|
4
3
|
|
5
4
|
module SimpleIDN
|
6
5
|
# The ConversionError is raised when an error occurs during a
|
@@ -223,7 +222,7 @@ module SimpleIDN
|
|
223
222
|
mapped = str.codepoints.map { |cp| UTS64MAPPING.fetch(cp, cp) }
|
224
223
|
mapped = mapped.map { |cp| TRANSITIONAL.fetch(cp, cp) } if transitional
|
225
224
|
mapped = mapped.flatten.map { |cp| cp.chr(Encoding::UTF_8) }.join(EMPTY)
|
226
|
-
mapped.
|
225
|
+
mapped.unicode_normalize(:nfc)
|
227
226
|
end
|
228
227
|
|
229
228
|
# Converts a UTF-8 unicode string to a punycode ACE string.
|
data/simpleidn.gemspec
CHANGED
@@ -16,11 +16,8 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.
|
19
|
+
spec.add_development_dependency "rake", "~> 13.0.3"
|
20
|
+
spec.add_development_dependency "rspec", "~> 3.10"
|
20
21
|
|
21
|
-
spec.
|
22
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
-
|
25
|
-
spec.required_ruby_version = '>1.9'
|
22
|
+
spec.required_ruby_version = '>=2.2'
|
26
23
|
end
|