unicode 0.3.1.1-x86-mswin32-60 → 0.4.0.1-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/README +7 -6
- data/Rakefile +8 -1
- data/ext/unicode/unicode.c +57 -2
- data/ext/unicode/unidata.map +1870 -2
- data/lib/unicode/1.8/unicode_native.so +0 -0
- data/lib/unicode/1.9/unicode_native.so +0 -0
- data/tools/normtest.rb +111 -0
- data/unicode.gemspec +2 -2
- metadata +6 -5
Binary file
|
Binary file
|
data/tools/normtest.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
#! /usr/local/bin/ruby -KU
|
2
|
+
|
3
|
+
## Conformance test with NormaliztionTest.txt
|
4
|
+
## Copyrigth 2010 yoshidam
|
5
|
+
|
6
|
+
require 'unicode'
|
7
|
+
|
8
|
+
TESTFILE = "NormalizationTest.txt"
|
9
|
+
|
10
|
+
def from_hex(str)
|
11
|
+
ret = ""
|
12
|
+
chars = str.split(" ")
|
13
|
+
chars.each do |c|
|
14
|
+
ret << [c.hex].pack("U")
|
15
|
+
end
|
16
|
+
return ret
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_hex(str)
|
20
|
+
ret = ""
|
21
|
+
str = str.unpack('U*')
|
22
|
+
str.each do |c|
|
23
|
+
ret += sprintf("%04X ", c)
|
24
|
+
end
|
25
|
+
ret
|
26
|
+
end
|
27
|
+
|
28
|
+
open(TESTFILE) do |f|
|
29
|
+
while l = f.gets
|
30
|
+
next if l =~ /^#/
|
31
|
+
l.chomp
|
32
|
+
if l =~ /^@/
|
33
|
+
puts l
|
34
|
+
next
|
35
|
+
end
|
36
|
+
c1, c2, c3, c4, c5 = l.split(';')
|
37
|
+
code = c1
|
38
|
+
c1 = from_hex(c1)
|
39
|
+
c2 = from_hex(c2)
|
40
|
+
c3 = from_hex(c3)
|
41
|
+
c4 = from_hex(c4)
|
42
|
+
c5 = from_hex(c5)
|
43
|
+
## NFC TEST
|
44
|
+
if c2 == Unicode.nfc(c1) && c2 == Unicode.nfc(c2) &&
|
45
|
+
c2 == Unicode.nfc(c3) &&
|
46
|
+
c4 == Unicode.nfc(c4) && c4 == Unicode.nfc(c4)
|
47
|
+
##puts "NFC OK: " + code
|
48
|
+
else
|
49
|
+
puts "NFC NG: " + to_hex(c1)
|
50
|
+
printf(" c2=%s NFC(c1)=%s NFC(c2)=%s NFC(c3)=%s\n",
|
51
|
+
to_hex(c2),
|
52
|
+
to_hex(Unicode.nfc(c1)),
|
53
|
+
to_hex(Unicode.nfc(c2)),
|
54
|
+
to_hex(Unicode.nfc(c3)))
|
55
|
+
printf(" c4=%s NFC(c4)=%s NFC(c5)=%s\n",
|
56
|
+
to_hex(c4),
|
57
|
+
to_hex(Unicode.nfc(c4)),
|
58
|
+
to_hex(Unicode.nfc(c5)))
|
59
|
+
end
|
60
|
+
|
61
|
+
## NFD TEST
|
62
|
+
if c3 == Unicode.nfd(c1) && c3 == Unicode.nfd(c2) &&
|
63
|
+
c3 == Unicode.nfd(c3) &&
|
64
|
+
c5 == Unicode.nfd(c4) && c5 == Unicode.nfd(c5)
|
65
|
+
##puts "NFD OK: " + code
|
66
|
+
else
|
67
|
+
puts "NFD NG: " + to_hex(c1)
|
68
|
+
printf(" c3=%s NFD(c1)=%s NFD(c2)=%s NFD(c3)=%s\n",
|
69
|
+
to_hex(c3),
|
70
|
+
to_hex(Unicode.nfd(c1)),
|
71
|
+
to_hex(Unicode.nfd(c2)),
|
72
|
+
to_hex(Unicode.nfd(c3)))
|
73
|
+
printf(" c5=%s NFD(c4)=%s NFD(c5)=%s\n",
|
74
|
+
to_hex(c5),
|
75
|
+
to_hex(Unicode.nfd(c4)),
|
76
|
+
to_hex(Unicode.nfd(c5)))
|
77
|
+
end
|
78
|
+
|
79
|
+
## NFKC TEST
|
80
|
+
if c4 == Unicode.nfkc(c1) && c4 == Unicode.nfkc(c2) &&
|
81
|
+
c4 == Unicode.nfkc(c3) &&
|
82
|
+
c4 == Unicode.nfkc(c4) && c4 == Unicode.nfkc(c5)
|
83
|
+
##puts "NFKC OK: " + code
|
84
|
+
else
|
85
|
+
puts "NFKC NG: " + to_hex(c1)
|
86
|
+
printf(" c4=%s NFKC(c1)=%s NFKC(c2)=%s NFKC(c3)=%s NFKC(c4)=%s NFKC(c5)=%s\n",
|
87
|
+
to_hex(c4),
|
88
|
+
to_hex(Unicode.nfkc(c1)),
|
89
|
+
to_hex(Unicode.nfkc(c2)),
|
90
|
+
to_hex(Unicode.nfkc(c3)),
|
91
|
+
to_hex(Unicode.nfkc(c4)),
|
92
|
+
to_hex(Unicode.nfkc(c5)))
|
93
|
+
end
|
94
|
+
|
95
|
+
## NFKD TEST
|
96
|
+
if c5 == Unicode.nfkd(c1) && c5 == Unicode.nfkd(c2) &&
|
97
|
+
c5 == Unicode.nfkd(c3) &&
|
98
|
+
c5 == Unicode.nfkd(c4) && c5 == Unicode.nfkd(c5)
|
99
|
+
##puts "NFKD OK: " + code
|
100
|
+
else
|
101
|
+
puts "NFKD NG: " + to_hex(c1)
|
102
|
+
printf(" c5=%s NFKD(c1)=%s NFKD(c2)=%s NFKD(c3)=%s NFKD(c4)=%s NFKD(c5)=%s\n",
|
103
|
+
to_hex(c5),
|
104
|
+
to_hex(Unicode.nfkd(c1)),
|
105
|
+
to_hex(Unicode.nfkd(c2)),
|
106
|
+
to_hex(Unicode.nfkd(c3)),
|
107
|
+
to_hex(Unicode.nfkd(c4)),
|
108
|
+
to_hex(Unicode.nfkd(c5)))
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
data/unicode.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new { |s|
|
2
2
|
s.name = %q{unicode}
|
3
|
-
s.version = %q{0.
|
4
|
-
s.date = %q{2010-
|
3
|
+
s.version = %q{0.4.0.1}
|
4
|
+
s.date = %q{2010-10-14}
|
5
5
|
s.summary = %q{Unicode normalization library.}
|
6
6
|
s.require_paths = %w[lib]
|
7
7
|
s.author = %q{Yoshida Masato}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 109
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
8
|
+
- 4
|
9
|
+
- 0
|
10
10
|
- 1
|
11
|
-
version: 0.
|
11
|
+
version: 0.4.0.1
|
12
12
|
platform: x86-mswin32-60
|
13
13
|
authors:
|
14
14
|
- Yoshida Masato
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-10-14 00:00:00 -03:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- test/test.rb
|
43
43
|
- tools/README
|
44
44
|
- tools/mkunidata.rb
|
45
|
+
- tools/normtest.rb
|
45
46
|
- unicode.gemspec
|
46
47
|
- lib/unicode/1.8/unicode_native.so
|
47
48
|
- lib/unicode/1.9/unicode_native.so
|