summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-07-02 11:11:46 +0200
committerGeremia Taglialatela <[email protected]>2023-07-02 11:11:46 +0200
commit70138e30aa2587134ccfeb20f409fa6eea16dc3f (patch)
tree1d8c3c099610ec30cb5d1e06904b6d42c3867346
parentf2f6177efac76e6015b98c3290fd1839b8568fbe (diff)
downloadcaxlsx-70138e30aa2587134ccfeb20f409fa6eea16dc3f.tar.gz
caxlsx-70138e30aa2587134ccfeb20f409fa6eea16dc3f.zip
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.
-rw-r--r--lib/axlsx/util/constants.rb5
1 files 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