lib/unibits.rb in unibits-1.1.0 vs lib/unibits.rb in unibits-1.2.0
- old
+ new
@@ -2,10 +2,11 @@
require_relative "unibits/symbolify"
require "io/console"
require "paint"
require "unicode/display_width"
+require "unicode/categories"
module Unibits
SUPPORTED_ENCODINGS = [
'UTF-8',
'UTF-16LE',
@@ -58,11 +59,15 @@
puts
string.each_char{ |char|
if char.valid_encoding?
char_valid = true
- current_color = random_color
current_encoding_error = nil
+ if Unicode::Categories.category(char) == "Cn"
+ current_color = "#FF5500"
+ else
+ current_color = random_color
+ end
else
char_valid = false
current_color = :red
end