Project

General

Profile

Bug #15933 » ruby-changes.patch

gareth (Gareth Adams), 06/19/2019 11:42 AM

View differences:

lib/open-uri.rb
# It can be used to guess charset.
#
# If charset parameter and block is not given,
# nil is returned except text type in HTTP.
# nil is returned except text type.
# In that case, "iso-8859-1" is returned as defined by RFC2616 3.7.1.
def charset
type, *parameters = content_type_parse
......
pair.last.downcase
elsif block_given?
yield
elsif type && %r{\Atext/} =~ type &&
@base_uri && /\Ahttp\z/i =~ @base_uri.scheme
elsif type && %r{\Atext/} =~ type
"iso-8859-1" # RFC2616 3.7.1
else
nil
-
lib/open-uri.rb
#
# If charset parameter and block is not given,
# nil is returned except text type.
# In that case, "iso-8859-1" is returned as defined by RFC2616 3.7.1.
# In that case, "utf-8" is returned as defined by RFC6838 4.2.1
def charset
type, *parameters = content_type_parse
if pair = parameters.assoc('charset')
......
elsif block_given?
yield
elsif type && %r{\Atext/} =~ type
"iso-8859-1" # RFC2616 3.7.1
"utf-8" # RFC6838 4.2.1
else
nil
end
(2-2/3)