开发者

How can Nokogiri extract the Charset encoding of a scraped HTML document?

Found a snippet tha开发者_Python百科t works for HTML Simple Dom Parser.

$el=$html->find('meta[http-equiv=Content-Type]',0);
$fullvalue = $el->content;
preg_match('/charset=(.+)/', $fullvalue, $matches);
echo $matches[1];

Can somebody help me to convert this so that this suits for Ruby and Nokogiri?


meta_encoding()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜