Skip to content

Commit b807af1

Browse files
committed
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.
1 parent 6f333cf commit b807af1

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
### Unreleased
44

5+
* Remove `iconv` conditional require
6+
57
### Version v1.19.1
68

79
* Fix error when parsing values consisting of `!important` only

lib/css_parser.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
require 'digest/md5'
77
require 'zlib'
88
require 'stringio'
9-
require 'iconv' unless String.method_defined?(:encode)
109

1110
require 'css_parser/version'
1211
require 'css_parser/rule_set'

lib/css_parser/parser.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -677,12 +677,7 @@ def read_remote_file(uri) # :nodoc:
677677
end
678678

679679
if charset
680-
if String.method_defined?(:encode)
681-
src.encode!('UTF-8', charset)
682-
else
683-
ic = Iconv.new('UTF-8//IGNORE', charset)
684-
src = ic.iconv(src)
685-
end
680+
src.encode!('UTF-8', charset)
686681
end
687682
rescue
688683
@redirect_count = nil

0 commit comments

Comments
 (0)