[Python]-problems found when using Chardet to check page encoding formats

Source: Internet
Author: User

The following problems were recently found when using Chardet to check the page encoding format:

Open the Web page with Urllib and check the encoding format and open the Web page with URLLIB2 to check the encoding format results are different, so urllib2 open may cause problems, need attention.

Use URLLIB2 to open the Web page and check the encoding format:

As a result, there is a case in which the character encoding of the Sina network is none:

However, if you use Urllib to open the URL, there is no problem checking the encoding format:

The result of the run, the character encoding of all URLs is detected, the result is as follows:

[Python]-problems found when using Chardet to check page encoding formats

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.