Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove iconv conditional require
Browse files Browse the repository at this point in the history
Drop legacy character encoding support for Ruby versions  prior to 1.9,
as string encoding is now natively supported in modern Ruby versions.
tagliala committed Dec 12, 2024
1 parent 6f333cf commit fbd1e64
Showing 2 changed files with 1 addition and 7 deletions.
1 change: 0 additions & 1 deletion lib/css_parser.rb
Original file line number Diff line number Diff line change
@@ -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'
7 changes: 1 addition & 6 deletions lib/css_parser/parser.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fbd1e64

Please sign in to comment.