def charset_from_meta_content(string)

      charset_match = string.match(/charset\s*\=\s*(.+)/i)

      if charset_match

        charset_value = charset_match[1]

        charset_value[/\A\"(.*)\"/, 1] ||
        charset_value[/\A\'(.*)\'/, 1] ||
        charset_value[/(.*)[\s;]/, 1] ||
        charset_value[/(.*)/, 1]
      else
        nil
      end

    end
def charset_from_meta_content(string)

      charset_match = string.match(/charset\s*\=\s*(.+)/i)

      if charset_match

        charset_value = charset_match[1]

        charset_value[/\A\"(.*)\"/, 1] ||
        charset_value[/\A\'(.*)\'/, 1] ||
        charset_value[/(.*)[\s;]/, 1] ||
        charset_value[/(.*)/, 1]
      else
        nil
      end

    end
Given a string representing the 'content' attribute value of a meta tag
 with an `http-equiv` attribute, returns the charset specified within that
 value, or nil.