From 70138e30aa2587134ccfeb20f409fa6eea16dc3f Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sun, 2 Jul 2023 11:11:46 +0200 Subject: Remove conditional check for `encode` method All supported Ruby versions now support the `encode` method on strings, so the conditional check for this method has been removed. Even if the default encoding on Ruby >= 2.0 is UTF-8, this is not always the case when the `LANG` environment variable is not set to `C.UTF-8`, so the `encode` method has been preserved. Additionally, this commit updates a link to use the `https` protocol for improved security. --- lib/axlsx/util/constants.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/axlsx/util/constants.rb b/lib/axlsx/util/constants.rb index 0767be31..1c5c0033 100644 --- a/lib/axlsx/util/constants.rb +++ b/lib/axlsx/util/constants.rb @@ -397,9 +397,8 @@ module Axlsx # x0A Line Feed (Lf) # x0D Carriage Return (Cr) # x09 Character Tabulation - # @see http://www.codetable.net/asciikeycodes - pattern = "\x0-\x08\x0B\x0C\x0E-\x1F" - pattern = pattern.respond_to?(:encode) ? pattern.encode('UTF-8') : pattern + # @see https://www.codetable.net/asciikeycodes + pattern = "\x0-\x08\x0B\x0C\x0E-\x1F".encode('UTF-8') # The regular expression used to remove control characters from worksheets CONTROL_CHARS = pattern.freeze -- cgit v1.2.3