Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DomCrawler] \Symfony\Component\DomCrawler\Crawler::addContent guess charset from html? #9061

Closed
@bronze1man

Description

@bronze1man

I just download this page.
http://search.jd.com/Search?keyword=%E6%96%87%E5%AD%A6&enc=utf-8&area=22&book=y
it do not send a header of charset in http response header and I put it content to Crawler::addContent,Then Crawler use wrong charset ISO-8859-1.
It works fine if I use follow code:

        $crawler = new Crawler();
        $crawler->addHtmlContent($content,'GBK');

Is there some way to guess charset from html meta?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DomCrawlerFeatureGood first issueIdeal for your first contribution! (some Symfony experience may be required)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions