Skip to content

Commit

Permalink
Merge pull request #170 from tagliala/chore/remove-iconv
Browse files Browse the repository at this point in the history
Remove `iconv` conditional require
  • Loading branch information
grosser authored Dec 12, 2024
2 parents 6f333cf + b807af1 commit 3cea380
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Unreleased

* Remove `iconv` conditional require

### Version v1.19.1

* Fix error when parsing values consisting of `!important` only
Expand Down
1 change: 0 additions & 1 deletion lib/css_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 1 addition & 6 deletions lib/css_parser/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3cea380

Please sign in to comment.