diff --git a/lib/thor/shell/table_printer.rb b/lib/thor/shell/table_printer.rb index 88828954..6ca57b2b 100644 --- a/lib/thor/shell/table_printer.rb +++ b/lib/thor/shell/table_printer.rb @@ -102,33 +102,17 @@ def print_border_separator def truncate(string) return string unless @truncate - as_unicode do - chars = string.chars.to_a - if chars.length <= @truncate - chars.join - else - chars[0, @truncate - 3 - @indent].join + "..." - end + chars = string.chars.to_a + if chars.length <= @truncate + chars.join + else + chars[0, @truncate - 3 - @indent].join + "..." end end def indentation " " * @indent end - - if "".respond_to?(:encode) - def as_unicode - yield - end - else - def as_unicode - old = $KCODE # rubocop:disable Style/GlobalVars - $KCODE = "U" # rubocop:disable Style/GlobalVars - yield - ensure - $KCODE = old # rubocop:disable Style/GlobalVars - end - end end end end