rchardet 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rchardet/chardistribution.rb +6 -6
- data/lib/rchardet/jpcntx.rb +2 -2
- data/lib/rchardet/version.rb +1 -1
- metadata +2 -2
@@ -111,7 +111,7 @@ module CharDet
|
|
111
111
|
# second byte range: 0xa1 -- 0xfe
|
112
112
|
# no validation needed here. State machine has done that
|
113
113
|
if aStr[0, 1] >= "\xC4"
|
114
|
-
bytes = aStr.bytes
|
114
|
+
bytes = aStr.bytes.to_a
|
115
115
|
return 94 * (bytes[0] - 0xC4) + bytes[1] - 0xA1
|
116
116
|
else
|
117
117
|
return -1
|
@@ -133,7 +133,7 @@ module CharDet
|
|
133
133
|
# second byte range: 0xa1 -- 0xfe
|
134
134
|
# no validation needed here. State machine has done that
|
135
135
|
if aStr[0, 1] >= "\xB0"
|
136
|
-
bytes = aStr.bytes
|
136
|
+
bytes = aStr.bytes.to_a
|
137
137
|
return 94 * (bytes[0] - 0xB0) + bytes[1] - 0xA1
|
138
138
|
else
|
139
139
|
return -1
|
@@ -155,7 +155,7 @@ module CharDet
|
|
155
155
|
# second byte range: 0xa1 -- 0xfe
|
156
156
|
# no validation needed here. State machine has done that
|
157
157
|
if (aStr[0, 1] >= "\xB0") and (aStr[1, 1] >= "\xA1")
|
158
|
-
bytes = aStr.bytes
|
158
|
+
bytes = aStr.bytes.to_a
|
159
159
|
return 94 * (bytes[0] - 0xB0) + bytes[1] - 0xA1
|
160
160
|
else
|
161
161
|
return -1
|
@@ -177,7 +177,7 @@ module CharDet
|
|
177
177
|
# second byte range: 0x40 -- 0x7e , 0xa1 -- 0xfe
|
178
178
|
# no validation needed here. State machine has done that
|
179
179
|
if aStr[0, 1] >= "\xA4"
|
180
|
-
bytes = aStr.bytes
|
180
|
+
bytes = aStr.bytes.to_a
|
181
181
|
if aStr[1, 1] >= "\xA1"
|
182
182
|
return 157 * (bytes[0] - 0xA4) + bytes[1] - 0xA1 + 63
|
183
183
|
else
|
@@ -202,7 +202,7 @@ module CharDet
|
|
202
202
|
# first byte range: 0x81 -- 0x9f , 0xe0 -- 0xfe
|
203
203
|
# second byte range: 0x40 -- 0x7e, 0x81 -- oxfe
|
204
204
|
# no validation needed here. State machine has done that
|
205
|
-
bytes = aStr.bytes
|
205
|
+
bytes = aStr.bytes.to_a
|
206
206
|
if (aStr[0, 1] >= "\x81") and (aStr[0, 1] <= "\x9F")
|
207
207
|
order = 188 * (bytes[0] - 0x81)
|
208
208
|
elsif (aStr[0, 1] >= "\xE0") and (aStr[0, 1] <= "\xEF")
|
@@ -232,7 +232,7 @@ module CharDet
|
|
232
232
|
# second byte range: 0xa1 -- 0xfe
|
233
233
|
# no validation needed here. State machine has done that
|
234
234
|
if aStr[0, 1] >= "\xA0"
|
235
|
-
bytes = aStr.bytes
|
235
|
+
bytes = aStr.bytes.to_a
|
236
236
|
return 94 * (bytes[0] - 0xA1) + bytes[1] - 0xa1
|
237
237
|
else
|
238
238
|
return -1
|
data/lib/rchardet/jpcntx.rb
CHANGED
@@ -195,7 +195,7 @@ module CharDet
|
|
195
195
|
if aStr.length > 1
|
196
196
|
second = aStr[1, 1]
|
197
197
|
if (first == "\202") and (second >= "\x9F") and (second <= "\xF1")
|
198
|
-
return aStr[1] - 0x9F, charLen
|
198
|
+
return aStr[1].ord - 0x9F, charLen
|
199
199
|
end
|
200
200
|
end
|
201
201
|
|
@@ -220,7 +220,7 @@ module CharDet
|
|
220
220
|
if aStr.length > 1
|
221
221
|
second = aStr[1, 1]
|
222
222
|
if (first == "\xA4") and (second >= "\xA1") and (second <= "\xF3")
|
223
|
-
return aStr[1] - 0xA1, charLen
|
223
|
+
return aStr[1].ord - 0xA1, charLen
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
data/lib/rchardet/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rchardet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -68,7 +68,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
68
|
requirements:
|
69
69
|
- - ! '>='
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
71
|
+
version: 1.9.3
|
72
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|