Skip to content

Commit

Permalink
Remove Iconv, which was deprecated in ruby 1.9.3, from lib/target.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
urbanadventurer committed Dec 5, 2017
1 parent 54f0069 commit b4cb039
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,10 @@ def open
def open_file
# target is a file
@body = File.open(@target).read
if String.method_defined?(:encode)
@body.encode!('UTF-16', 'UTF-8', invalid: :replace, replace: '')
@body.encode!('UTF-8', 'UTF-16')
else
ic = Iconv.new('UTF-8', 'UTF-8//IGNORE')
@body = ic.iconv(@body)
end

@body.encode!('UTF-16', 'UTF-8', invalid: :replace, replace: '')
@body.encode!('UTF-8', 'UTF-16')

# target is a http packet file
if @body =~ /^HTTP\/1\.\d [\d]{3} (.+)\r\n\r\n/m
# extract http header
Expand Down Expand Up @@ -313,6 +310,11 @@ def open_url(options)

@body = res.body


# @body.encode!('UTF-16', 'UTF-8', invalid: :replace, replace: '')
# @body.encode!('UTF-8', 'UTF-16')


@body = @body.force_encoding("UTF-8") # do we only need this in the body?

@status = res.code.to_i
Expand Down
1 change: 1 addition & 0 deletions whatweb
Original file line number Diff line number Diff line change
Expand Up @@ -661,4 +661,5 @@ end
# close down logging and plugins
logging_list.each(&:close)
Plugin.shutdown_all

# pp $PLUGIN_TIMES.sort_by {|x,y|y }

0 comments on commit b4cb039

Please sign in to comment.