From fbd1e6426f3f25fbb97c30d83620f07dd4276d73 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Thu, 12 Dec 2024 09:34:21 +0100 Subject: [PATCH] Remove `iconv` conditional require Drop legacy character encoding support for Ruby versions prior to 1.9, as string encoding is now natively supported in modern Ruby versions. --- lib/css_parser.rb | 1 - lib/css_parser/parser.rb | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/css_parser.rb b/lib/css_parser.rb index b50f81b..2fbbd20 100644 --- a/lib/css_parser.rb +++ b/lib/css_parser.rb @@ -6,7 +6,6 @@ require 'digest/md5' require 'zlib' require 'stringio' -require 'iconv' unless String.method_defined?(:encode) require 'css_parser/version' require 'css_parser/rule_set' diff --git a/lib/css_parser/parser.rb b/lib/css_parser/parser.rb index 11dd36f..e199e3b 100644 --- a/lib/css_parser/parser.rb +++ b/lib/css_parser/parser.rb @@ -677,12 +677,7 @@ def read_remote_file(uri) # :nodoc: end if charset - if String.method_defined?(:encode) - src.encode!('UTF-8', charset) - else - ic = Iconv.new('UTF-8//IGNORE', charset) - src = ic.iconv(src) - end + src.encode!('UTF-8', charset) end rescue @redirect_count = nil