module Patron::ResponseDecoding
def encoding_from_headers_or_binary
def encoding_from_headers_or_binary return Encoding::BINARY unless charset_name = charset_from_content_type Encoding.find(charset_name) rescue ArgumentError => e # invalid charset name raise HeaderCharsetInvalid, INVALID_CHARSET_NAME_ERROR % {content_type: @headers['Content-Type'].inspect} end