unibits 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +5 -0
- data/lib/unibits.rb +1 -1
- data/lib/unibits/version.rb +1 -1
- data/unibits.gemspec +2 -1
- metadata +19 -6
- data/lib/unibits/symbolify.rb +0 -480
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9d89e598970e15c646b6d3dce0969afe24204fe
|
4
|
+
data.tar.gz: '0473794df2d445d3d0bc5d6f5c697d0c148de119'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9bd47214da917798bb5e40ad7bdaf80d93a0fd2b07d43f825b8819fb81eca54935f4eff5ae3b508a8213895366a2898b049b558e368c6e69b275f7a3a86bb8f
|
7
|
+
data.tar.gz: 71c2583c9935c7ceead69c8d7c694af2f621bc08f952c896d0e24baf8688d747724315e1fe178e98c1e0e2138d830306e3623804ad9dd37b81c100ffa7394e19
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## CHANGELOG
|
2
2
|
|
3
|
+
### 2.4.0
|
4
|
+
|
5
|
+
* Extract symbolification logic into extra [symbolify](https://github.com/janlelis/symbolify) gem (includes fixes and non-character detection)
|
6
|
+
* Update characteristics gem (includes a new blank)
|
7
|
+
|
3
8
|
### 2.3.0
|
4
9
|
|
5
10
|
* More consistent handling of bidi controls (always symbolify with alias, but highlight ALM, RLM, LRM as blanks)
|
data/lib/unibits.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require_relative "unibits/version"
|
2
|
-
require_relative "unibits/symbolify"
|
3
2
|
|
4
3
|
require "io/console"
|
5
4
|
require "paint"
|
6
5
|
require "unicode/display_width"
|
7
6
|
require "characteristics"
|
7
|
+
require "symbolify"
|
8
8
|
|
9
9
|
module Unibits
|
10
10
|
SUPPORTED_ENCODINGS = Encoding.name_list.grep(
|
data/lib/unibits/version.rb
CHANGED
data/unibits.gemspec
CHANGED
@@ -19,7 +19,8 @@ Gem::Specification.new do |gem|
|
|
19
19
|
|
20
20
|
gem.add_dependency 'paint', '>= 0.9', '< 3.0'
|
21
21
|
gem.add_dependency 'unicode-display_width', '~> 1.1'
|
22
|
-
gem.add_dependency '
|
22
|
+
gem.add_dependency 'symbolify', '~> 1.0'
|
23
|
+
gem.add_dependency 'characteristics', '>= 0.5.2'
|
23
24
|
gem.add_dependency 'rationalist', '~> 2.0'
|
24
25
|
|
25
26
|
gem.required_ruby_version = "~> 2.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unibits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paint
|
@@ -45,19 +45,33 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '1.1'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: symbolify
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0
|
53
|
+
version: '1.0'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0
|
60
|
+
version: '1.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: characteristics
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.5.2
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.5.2
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: rationalist
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +108,6 @@ files:
|
|
94
108
|
- bin/unibits
|
95
109
|
- lib/unibits.rb
|
96
110
|
- lib/unibits/kernel_method.rb
|
97
|
-
- lib/unibits/symbolify.rb
|
98
111
|
- lib/unibits/version.rb
|
99
112
|
- spec/unibits_spec.rb
|
100
113
|
- unibits.gemspec
|
data/lib/unibits/symbolify.rb
DELETED
@@ -1,480 +0,0 @@
|
|
1
|
-
module Unibits
|
2
|
-
module Symbolify
|
3
|
-
NO_UTF8_CONVERTER = /^(Windows-1258|IBM864|macCentEuro|macThai)/
|
4
|
-
ASCII_CHARS = "\x20-\x7E".freeze
|
5
|
-
ASCII_CONTROL_CODEPOINTS = "\x00-\x1F\x7F".freeze
|
6
|
-
ASCII_CONTROL_SYMBOLS = "\u{2400}-\u{241F}\u{2421}".freeze
|
7
|
-
TAGS = "\u{E0021}-\u{E007E}".freeze
|
8
|
-
|
9
|
-
CONTROL_C0_SYMBOLS = [
|
10
|
-
"␀",
|
11
|
-
"␁",
|
12
|
-
"␂",
|
13
|
-
"␃",
|
14
|
-
"␄",
|
15
|
-
"␅",
|
16
|
-
"␆",
|
17
|
-
"␇",
|
18
|
-
"␈",
|
19
|
-
"␉",
|
20
|
-
"␊",
|
21
|
-
"␋",
|
22
|
-
"␌",
|
23
|
-
"␍",
|
24
|
-
"␎",
|
25
|
-
"␏",
|
26
|
-
"␐",
|
27
|
-
"␑",
|
28
|
-
"␒",
|
29
|
-
"␓",
|
30
|
-
"␔",
|
31
|
-
"␕",
|
32
|
-
"␖",
|
33
|
-
"␗",
|
34
|
-
"␘",
|
35
|
-
"␙",
|
36
|
-
"␚",
|
37
|
-
"␛",
|
38
|
-
"␜",
|
39
|
-
"␝",
|
40
|
-
"␞",
|
41
|
-
"␟",
|
42
|
-
]
|
43
|
-
|
44
|
-
CONTROL_DELETE_SYMBOL = "␡"
|
45
|
-
|
46
|
-
CONTROL_C1_NAMES = {
|
47
|
-
0x80 => "PAD",
|
48
|
-
0x81 => "HOP",
|
49
|
-
0x82 => "BPH",
|
50
|
-
0x83 => "NBH",
|
51
|
-
0x84 => "IND",
|
52
|
-
0x85 => "NEL",
|
53
|
-
0x86 => "SSA",
|
54
|
-
0x87 => "ESA",
|
55
|
-
0x88 => "HTS",
|
56
|
-
0x89 => "HTJ",
|
57
|
-
0x8A => "VTS",
|
58
|
-
0x8B => "PLD",
|
59
|
-
0x8C => "PLU",
|
60
|
-
0x8D => "RI",
|
61
|
-
0x8E => "SS2",
|
62
|
-
0x8F => "SS3",
|
63
|
-
0x90 => "DCS",
|
64
|
-
0x91 => "PU1",
|
65
|
-
0x92 => "PU2",
|
66
|
-
0x93 => "STS",
|
67
|
-
0x94 => "CCH",
|
68
|
-
0x95 => "MW",
|
69
|
-
0x96 => "SPA",
|
70
|
-
0x97 => "EPA",
|
71
|
-
0x98 => "SOS",
|
72
|
-
0x99 => "SGC",
|
73
|
-
0x9A => "SCI",
|
74
|
-
0x9B => "CSI",
|
75
|
-
0x9C => "ST",
|
76
|
-
0x9D => "OSC",
|
77
|
-
0x9E => "PM",
|
78
|
-
0x9F => "APC",
|
79
|
-
}
|
80
|
-
|
81
|
-
BIDI_CONTROL_NAMES = {
|
82
|
-
0x061C => "ALM",
|
83
|
-
0x200E => "LRM",
|
84
|
-
0x200F => "RLM",
|
85
|
-
0x202A => "LRE",
|
86
|
-
0x202B => "RLE",
|
87
|
-
0x202C => "PDF",
|
88
|
-
0x202D => "LRO",
|
89
|
-
0x202E => "RLO",
|
90
|
-
0x2066 => "LRI",
|
91
|
-
0x2067 => "RLI",
|
92
|
-
0x2068 => "FSI",
|
93
|
-
0x2069 => "PDI",
|
94
|
-
}
|
95
|
-
|
96
|
-
INTERESTING_CODEPOINTS = {
|
97
|
-
0x180B => "FVS1",
|
98
|
-
0x180C => "FVS2",
|
99
|
-
0x180D => "FVS3",
|
100
|
-
|
101
|
-
0xFE00 => "VS1",
|
102
|
-
0xFE01 => "VS2",
|
103
|
-
0xFE02 => "VS3",
|
104
|
-
0xFE03 => "VS4",
|
105
|
-
0xFE04 => "VS5",
|
106
|
-
0xFE05 => "VS6",
|
107
|
-
0xFE06 => "VS7",
|
108
|
-
0xFE07 => "VS8",
|
109
|
-
0xFE08 => "VS9",
|
110
|
-
0xFE09 => "VS10",
|
111
|
-
0xFE0A => "VS11",
|
112
|
-
0xFE0B => "VS12",
|
113
|
-
0xFE0C => "VS13",
|
114
|
-
0xFE0D => "VS14",
|
115
|
-
0xFE0E => "VS15",
|
116
|
-
0xFE0F => "VS16",
|
117
|
-
|
118
|
-
0xE0001 => "LANG TAG",
|
119
|
-
0xE0020 => "TAG ␠",
|
120
|
-
0xE007F => "TAG ␡",
|
121
|
-
|
122
|
-
0xE0100 => "VS17",
|
123
|
-
0xE0101 => "VS18",
|
124
|
-
0xE0102 => "VS19",
|
125
|
-
0xE0103 => "VS20",
|
126
|
-
0xE0104 => "VS21",
|
127
|
-
0xE0105 => "VS22",
|
128
|
-
0xE0106 => "VS23",
|
129
|
-
0xE0107 => "VS24",
|
130
|
-
0xE0108 => "VS25",
|
131
|
-
0xE0109 => "VS26",
|
132
|
-
0xE010A => "VS27",
|
133
|
-
0xE010B => "VS28",
|
134
|
-
0xE010C => "VS29",
|
135
|
-
0xE010D => "VS30",
|
136
|
-
0xE010E => "VS31",
|
137
|
-
0xE010F => "VS32",
|
138
|
-
0xE0110 => "VS33",
|
139
|
-
0xE0111 => "VS34",
|
140
|
-
0xE0112 => "VS35",
|
141
|
-
0xE0113 => "VS36",
|
142
|
-
0xE0114 => "VS37",
|
143
|
-
0xE0115 => "VS38",
|
144
|
-
0xE0116 => "VS39",
|
145
|
-
0xE0117 => "VS40",
|
146
|
-
0xE0118 => "VS41",
|
147
|
-
0xE0119 => "VS42",
|
148
|
-
0xE011A => "VS43",
|
149
|
-
0xE011B => "VS44",
|
150
|
-
0xE011C => "VS45",
|
151
|
-
0xE011D => "VS46",
|
152
|
-
0xE011E => "VS47",
|
153
|
-
0xE011F => "VS48",
|
154
|
-
0xE0120 => "VS49",
|
155
|
-
0xE0121 => "VS50",
|
156
|
-
0xE0122 => "VS51",
|
157
|
-
0xE0123 => "VS52",
|
158
|
-
0xE0124 => "VS53",
|
159
|
-
0xE0125 => "VS54",
|
160
|
-
0xE0126 => "VS55",
|
161
|
-
0xE0127 => "VS56",
|
162
|
-
0xE0128 => "VS57",
|
163
|
-
0xE0129 => "VS58",
|
164
|
-
0xE012A => "VS59",
|
165
|
-
0xE012B => "VS60",
|
166
|
-
0xE012C => "VS61",
|
167
|
-
0xE012D => "VS62",
|
168
|
-
0xE012E => "VS63",
|
169
|
-
0xE012F => "VS64",
|
170
|
-
0xE0130 => "VS65",
|
171
|
-
0xE0131 => "VS66",
|
172
|
-
0xE0132 => "VS67",
|
173
|
-
0xE0133 => "VS68",
|
174
|
-
0xE0134 => "VS69",
|
175
|
-
0xE0135 => "VS70",
|
176
|
-
0xE0136 => "VS71",
|
177
|
-
0xE0137 => "VS72",
|
178
|
-
0xE0138 => "VS73",
|
179
|
-
0xE0139 => "VS74",
|
180
|
-
0xE013A => "VS75",
|
181
|
-
0xE013B => "VS76",
|
182
|
-
0xE013C => "VS77",
|
183
|
-
0xE013D => "VS78",
|
184
|
-
0xE013E => "VS79",
|
185
|
-
0xE013F => "VS80",
|
186
|
-
0xE0140 => "VS81",
|
187
|
-
0xE0141 => "VS82",
|
188
|
-
0xE0142 => "VS83",
|
189
|
-
0xE0143 => "VS84",
|
190
|
-
0xE0144 => "VS85",
|
191
|
-
0xE0145 => "VS86",
|
192
|
-
0xE0146 => "VS87",
|
193
|
-
0xE0147 => "VS88",
|
194
|
-
0xE0148 => "VS89",
|
195
|
-
0xE0149 => "VS90",
|
196
|
-
0xE014A => "VS91",
|
197
|
-
0xE014B => "VS92",
|
198
|
-
0xE014C => "VS93",
|
199
|
-
0xE014D => "VS94",
|
200
|
-
0xE014E => "VS95",
|
201
|
-
0xE014F => "VS96",
|
202
|
-
0xE0150 => "VS97",
|
203
|
-
0xE0151 => "VS98",
|
204
|
-
0xE0152 => "VS99",
|
205
|
-
0xE0153 => "VS100",
|
206
|
-
0xE0154 => "VS101",
|
207
|
-
0xE0155 => "VS102",
|
208
|
-
0xE0156 => "VS103",
|
209
|
-
0xE0157 => "VS104",
|
210
|
-
0xE0158 => "VS105",
|
211
|
-
0xE0159 => "VS106",
|
212
|
-
0xE015A => "VS107",
|
213
|
-
0xE015B => "VS108",
|
214
|
-
0xE015C => "VS109",
|
215
|
-
0xE015D => "VS110",
|
216
|
-
0xE015E => "VS111",
|
217
|
-
0xE015F => "VS112",
|
218
|
-
0xE0160 => "VS113",
|
219
|
-
0xE0161 => "VS114",
|
220
|
-
0xE0162 => "VS115",
|
221
|
-
0xE0163 => "VS116",
|
222
|
-
0xE0164 => "VS117",
|
223
|
-
0xE0165 => "VS118",
|
224
|
-
0xE0166 => "VS119",
|
225
|
-
0xE0167 => "VS120",
|
226
|
-
0xE0168 => "VS121",
|
227
|
-
0xE0169 => "VS122",
|
228
|
-
0xE016A => "VS123",
|
229
|
-
0xE016B => "VS124",
|
230
|
-
0xE016C => "VS125",
|
231
|
-
0xE016D => "VS126",
|
232
|
-
0xE016E => "VS127",
|
233
|
-
0xE016F => "VS128",
|
234
|
-
0xE0170 => "VS129",
|
235
|
-
0xE0171 => "VS130",
|
236
|
-
0xE0172 => "VS131",
|
237
|
-
0xE0173 => "VS132",
|
238
|
-
0xE0174 => "VS133",
|
239
|
-
0xE0175 => "VS134",
|
240
|
-
0xE0176 => "VS135",
|
241
|
-
0xE0177 => "VS136",
|
242
|
-
0xE0178 => "VS137",
|
243
|
-
0xE0179 => "VS138",
|
244
|
-
0xE017A => "VS139",
|
245
|
-
0xE017B => "VS140",
|
246
|
-
0xE017C => "VS141",
|
247
|
-
0xE017D => "VS142",
|
248
|
-
0xE017E => "VS143",
|
249
|
-
0xE017F => "VS144",
|
250
|
-
0xE0180 => "VS145",
|
251
|
-
0xE0181 => "VS146",
|
252
|
-
0xE0182 => "VS147",
|
253
|
-
0xE0183 => "VS148",
|
254
|
-
0xE0184 => "VS149",
|
255
|
-
0xE0185 => "VS150",
|
256
|
-
0xE0186 => "VS151",
|
257
|
-
0xE0187 => "VS152",
|
258
|
-
0xE0188 => "VS153",
|
259
|
-
0xE0189 => "VS154",
|
260
|
-
0xE018A => "VS155",
|
261
|
-
0xE018B => "VS156",
|
262
|
-
0xE018C => "VS157",
|
263
|
-
0xE018D => "VS158",
|
264
|
-
0xE018E => "VS159",
|
265
|
-
0xE018F => "VS160",
|
266
|
-
0xE0190 => "VS161",
|
267
|
-
0xE0191 => "VS162",
|
268
|
-
0xE0192 => "VS163",
|
269
|
-
0xE0193 => "VS164",
|
270
|
-
0xE0194 => "VS165",
|
271
|
-
0xE0195 => "VS166",
|
272
|
-
0xE0196 => "VS167",
|
273
|
-
0xE0197 => "VS168",
|
274
|
-
0xE0198 => "VS169",
|
275
|
-
0xE0199 => "VS170",
|
276
|
-
0xE019A => "VS171",
|
277
|
-
0xE019B => "VS172",
|
278
|
-
0xE019C => "VS173",
|
279
|
-
0xE019D => "VS174",
|
280
|
-
0xE019E => "VS175",
|
281
|
-
0xE019F => "VS176",
|
282
|
-
0xE01A0 => "VS177",
|
283
|
-
0xE01A1 => "VS178",
|
284
|
-
0xE01A2 => "VS179",
|
285
|
-
0xE01A3 => "VS180",
|
286
|
-
0xE01A4 => "VS181",
|
287
|
-
0xE01A5 => "VS182",
|
288
|
-
0xE01A6 => "VS183",
|
289
|
-
0xE01A7 => "VS184",
|
290
|
-
0xE01A8 => "VS185",
|
291
|
-
0xE01A9 => "VS186",
|
292
|
-
0xE01AA => "VS187",
|
293
|
-
0xE01AB => "VS188",
|
294
|
-
0xE01AC => "VS189",
|
295
|
-
0xE01AD => "VS190",
|
296
|
-
0xE01AE => "VS191",
|
297
|
-
0xE01AF => "VS192",
|
298
|
-
0xE01B0 => "VS193",
|
299
|
-
0xE01B1 => "VS194",
|
300
|
-
0xE01B2 => "VS195",
|
301
|
-
0xE01B3 => "VS196",
|
302
|
-
0xE01B4 => "VS197",
|
303
|
-
0xE01B5 => "VS198",
|
304
|
-
0xE01B6 => "VS199",
|
305
|
-
0xE01B7 => "VS200",
|
306
|
-
0xE01B8 => "VS201",
|
307
|
-
0xE01B9 => "VS202",
|
308
|
-
0xE01BA => "VS203",
|
309
|
-
0xE01BB => "VS204",
|
310
|
-
0xE01BC => "VS205",
|
311
|
-
0xE01BD => "VS206",
|
312
|
-
0xE01BE => "VS207",
|
313
|
-
0xE01BF => "VS208",
|
314
|
-
0xE01C0 => "VS209",
|
315
|
-
0xE01C1 => "VS210",
|
316
|
-
0xE01C2 => "VS211",
|
317
|
-
0xE01C3 => "VS212",
|
318
|
-
0xE01C4 => "VS213",
|
319
|
-
0xE01C5 => "VS214",
|
320
|
-
0xE01C6 => "VS215",
|
321
|
-
0xE01C7 => "VS216",
|
322
|
-
0xE01C8 => "VS217",
|
323
|
-
0xE01C9 => "VS218",
|
324
|
-
0xE01CA => "VS219",
|
325
|
-
0xE01CB => "VS220",
|
326
|
-
0xE01CC => "VS221",
|
327
|
-
0xE01CD => "VS222",
|
328
|
-
0xE01CE => "VS223",
|
329
|
-
0xE01CF => "VS224",
|
330
|
-
0xE01D0 => "VS225",
|
331
|
-
0xE01D1 => "VS226",
|
332
|
-
0xE01D2 => "VS227",
|
333
|
-
0xE01D3 => "VS228",
|
334
|
-
0xE01D4 => "VS229",
|
335
|
-
0xE01D5 => "VS230",
|
336
|
-
0xE01D6 => "VS231",
|
337
|
-
0xE01D7 => "VS232",
|
338
|
-
0xE01D8 => "VS233",
|
339
|
-
0xE01D9 => "VS234",
|
340
|
-
0xE01DA => "VS235",
|
341
|
-
0xE01DB => "VS236",
|
342
|
-
0xE01DC => "VS237",
|
343
|
-
0xE01DD => "VS238",
|
344
|
-
0xE01DE => "VS239",
|
345
|
-
0xE01DF => "VS240",
|
346
|
-
0xE01E0 => "VS241",
|
347
|
-
0xE01E1 => "VS242",
|
348
|
-
0xE01E2 => "VS243",
|
349
|
-
0xE01E3 => "VS244",
|
350
|
-
0xE01E4 => "VS245",
|
351
|
-
0xE01E5 => "VS246",
|
352
|
-
0xE01E6 => "VS247",
|
353
|
-
0xE01E7 => "VS248",
|
354
|
-
0xE01E8 => "VS249",
|
355
|
-
0xE01E9 => "VS250",
|
356
|
-
0xE01EA => "VS251",
|
357
|
-
0xE01EB => "VS252",
|
358
|
-
0xE01EC => "VS253",
|
359
|
-
0xE01ED => "VS254",
|
360
|
-
0xE01EE => "VS255",
|
361
|
-
0xE01EF => "VS256",
|
362
|
-
}.freeze
|
363
|
-
|
364
|
-
INTERESTING_BYTES_ENCODINGS = {
|
365
|
-
0xD8 => /^macCroatian/,
|
366
|
-
0xF0 => /^mac(Iceland|Roman|Turkish)/,
|
367
|
-
0xFD => /^(ISO-8859-8|Windows-(1255|1256))/,
|
368
|
-
0xFE => /^(ISO-8859-8|Windows-(1255|1256))/,
|
369
|
-
}.freeze
|
370
|
-
|
371
|
-
INTERESTING_BYTES_VALUES = {
|
372
|
-
0xD8 => "Logo",
|
373
|
-
0xF0 => "Logo",
|
374
|
-
0xFD => "LRM",
|
375
|
-
0xFE => "RLM",
|
376
|
-
}.freeze
|
377
|
-
|
378
|
-
MAC_KEY_SYMBOLS = {
|
379
|
-
0x11 => "⌘",
|
380
|
-
0x12 => "⇧",
|
381
|
-
0x13 => "⌥",
|
382
|
-
0x14 => "⌃",
|
383
|
-
}
|
384
|
-
|
385
|
-
def self.symbolify(char, char_info)
|
386
|
-
if !char_info.valid?
|
387
|
-
"�"
|
388
|
-
else
|
389
|
-
case char_info
|
390
|
-
when UnicodeCharacteristics
|
391
|
-
Symbolify.unicode(char, char_info)
|
392
|
-
when ByteCharacteristics
|
393
|
-
Symbolify.byte(char, char_info)
|
394
|
-
when AsciiCharacteristics
|
395
|
-
Symbolify.ascii(char, char_info)
|
396
|
-
else
|
397
|
-
Symbolify.binary(char)
|
398
|
-
end
|
399
|
-
end
|
400
|
-
end
|
401
|
-
|
402
|
-
def self.unicode(char, char_info)
|
403
|
-
return "n/a" if !char_info.assigned?
|
404
|
-
|
405
|
-
char = char.dup.encode("UTF-8")
|
406
|
-
ord = char.ord
|
407
|
-
|
408
|
-
if char_info.delete?
|
409
|
-
char = CONTROL_DELETE_SYMBOL
|
410
|
-
elsif char_info.c0?
|
411
|
-
char = CONTROL_C0_SYMBOLS[ord]
|
412
|
-
elsif char_info.c1?
|
413
|
-
char = CONTROL_C1_NAMES[ord]
|
414
|
-
elsif char_info.bidi_control?
|
415
|
-
char = BIDI_CONTROL_NAMES[ord]
|
416
|
-
elsif char_info.category == "Mn"
|
417
|
-
char = "◌" + char
|
418
|
-
elsif char_info.category == "Me"
|
419
|
-
char = " " + char
|
420
|
-
elsif char_info.blank?
|
421
|
-
char = "]" + char + "["
|
422
|
-
elsif ord > 917536 && ord < 917631
|
423
|
-
char = "TAG " + char.tr(TAGS, ASCII_CHARS)
|
424
|
-
else
|
425
|
-
char = INTERESTING_CODEPOINTS[char.ord] || char
|
426
|
-
end
|
427
|
-
|
428
|
-
char
|
429
|
-
end
|
430
|
-
|
431
|
-
def self.byte(char, char_info)
|
432
|
-
return "n/a" if !char_info.assigned?
|
433
|
-
|
434
|
-
ord = char.ord
|
435
|
-
encoding = char_info.encoding
|
436
|
-
no_converter = !!(NO_UTF8_CONVERTER =~ encoding.name)
|
437
|
-
treat_char_unconverted = false
|
438
|
-
|
439
|
-
if char_info.delete?
|
440
|
-
char = CONTROL_DELETE_SYMBOL
|
441
|
-
elsif char_info.c0?
|
442
|
-
if ord >= 0x11 && ord <= 0x14 && encoding.name =~ /^mac/
|
443
|
-
char = MAC_KEY_SYMBOLS[ord]
|
444
|
-
else
|
445
|
-
char = CONTROL_C0_SYMBOLS[ord]
|
446
|
-
end
|
447
|
-
elsif char_info.c1?
|
448
|
-
char = CONTROL_C1_NAMES[ord]
|
449
|
-
elsif no_converter
|
450
|
-
treat_char_unconverted = true
|
451
|
-
elsif char_info.blank?
|
452
|
-
char = "]".encode(encoding) + char + "[".encode(encoding)
|
453
|
-
elsif INTERESTING_BYTES_ENCODINGS[ord] =~ encoding.name
|
454
|
-
char = INTERESTING_BYTES_VALUES[ord]
|
455
|
-
end
|
456
|
-
|
457
|
-
if no_converter && treat_char_unconverted
|
458
|
-
char.inspect
|
459
|
-
else
|
460
|
-
char.encode("UTF-8")
|
461
|
-
end
|
462
|
-
end
|
463
|
-
|
464
|
-
def self.ascii(char, char_info)
|
465
|
-
if char_info.delete?
|
466
|
-
char = CONTROL_DELETE_SYMBOL
|
467
|
-
elsif char_info.c0?
|
468
|
-
char = CONTROL_C0_SYMBOLS[char.ord]
|
469
|
-
elsif char_info.blank?
|
470
|
-
char = "]" + char + "["
|
471
|
-
end
|
472
|
-
|
473
|
-
char
|
474
|
-
end
|
475
|
-
|
476
|
-
def self.binary(char)
|
477
|
-
char.inspect
|
478
|
-
end
|
479
|
-
end
|
480
|
-
end
|