pQuery\DomNode::getEncoding PHP Method

getEncoding() public method

Try to determine the encoding of the current tag
public getEncoding ( ) : string | boolean
return string | boolean False if encoding could not be found
    function getEncoding()
    {
        $root = $this->getRoot();
        if ($root !== null) {
            if ($enc = $root->select('meta[charset]', 0, true, true)) {
                return $enc->getAttribute("charset");
            } elseif ($enc = $root->select('"?xml"[encoding]', 0, true, true)) {
                return $enc->getAttribute("encoding");
            } elseif ($enc = $root->select('meta[content*="charset="]', 0, true, true)) {
                $enc = $enc->getAttribute("content");
                return substr($enc, strpos($enc, "charset=") + 8);
            }
        }
        return false;
    }
DomNode