Htmlparser 2.0 Chinese garbled problem

Source: Internet
Author: User

For the Htmlparser 2.0 Toolkit we need to modify the Page.java file to make it suitable for Chinese HTML file parsing.

The main is to put protected static final String Default_charset = "Iso-8859-1";
Modified to protected static final String Default_charset = "gb2312";

The main is compatible with charset = ' GBK ' declaration of the page.


--because the default character set "Iso-8859-1" is used to parse HTML files containing Chinese, garbled characters will appear. The conversion of New String (Str.getbytes ("iso-8859-1"), "GB2312" must be done.

It's more troublesome to do so.

For the modified Htmlparser Toolkit, it needs to be recompiled and compressed into a. jar file for project invocation.

Htmlparser 2.0 Chinese garbled problem

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.