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()
精彩评论