Trying to get encoding from a webpage Python and BeautifulSoup
问题 Im trying to retrieve the charset from a webpage(this will change all the time). At the moment Im using beautifulSoup to parse the page and then extract the charset from the header. This was working fine until I ran into a site that had..... <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> My code up until now and which was working with other pages is: def get_encoding(soup): encod = soup.meta.get('charset') if encod == None: encod = soup.meta.get('content-type') if encod =