lib/unibits/symbolify.rb in unibits-2.1.1 vs lib/unibits/symbolify.rb in unibits-2.2.0
- old
+ new
@@ -77,10 +77,14 @@
0x9E => "PM",
0x9F => "APC",
}
INTERESTING_CODEPOINTS = {
+ 0x180B => "FVS1",
+ 0x180C => "FVS2",
+ 0x180D => "FVS3",
+
0x200E => "LRM",
0x200F => "RLM",
0x202A => "LRE",
0x202B => "RLE",
0x202C => "PDF",
@@ -89,10 +93,12 @@
0x2066 => "LRI",
0x2067 => "RLI",
0x2068 => "FSI",
0x2069 => "PDI",
+ 0x034F => "CGJ",
+
0xFE00 => "VS1",
0xFE01 => "VS2",
0xFE02 => "VS3",
0xFE03 => "VS4",
0xFE04 => "VS5",
@@ -393,29 +399,31 @@
end
def self.unicode(char, char_info)
return "n/a" if !char_info.assigned?
- char = char.dup
+ char = char.dup.encode("UTF-8")
ord = char.ord
- encoding = char_info.encoding
if char_info.delete?
char = CONTROL_DELETE_SYMBOL
elsif char_info.c0?
char = CONTROL_C0_SYMBOLS[ord]
elsif char_info.c1?
char = CONTROL_C1_NAMES[ord]
elsif char_info.blank?
- char = "]".encode(encoding) + char + "[".encode(encoding)
+ char = "]" + char + "["
elsif ord > 917536 && ord < 917631
- char = "TAG ".encode(encoding) +
- char.tr(TAGS.encode(encoding), ASCII_CHARS.encode(encoding))
+ char = "TAG " + char.tr(TAGS, ASCII_CHARS)
+ elsif char_info.category == "Mn"
+ char = "◌" + char
+ elsif char_info.category == "Me"
+ char = " " + char
else
char = INTERESTING_CODEPOINTS[char.ord] || char
end
- char.encode("UTF-8")
+ char
end
def self.byte(char, char_info)
return "n/a" if !char_info.assigned?