문제

I get the inner html for Persian web page with this method :

private static function getInnerHTML($node)
{
    $innerHTML = "";
    $children = $node->childNodes;
    foreach ($children as $child) {
        $tmp_doc = new DOMDocument();
        $tmp_doc->appendChild($tmp_doc->importNode($child,true));
        $innerHTML .= $tmp_doc->saveHTML();
    }
    return $innerHTML;
}

When I see the source in browser, I found the Persian characters as below :

گزارش

What can I do to convert this coding to regular Persian characters?

For example this chars must be : گزارش

Sorry, I don't know what is this coding, so I can't search for it before.

Thanks.

도움이 되었습니까?

해결책

As per my comment what you need is html_entity_decode.

$innerHTML .= html_entity_decode($tmp_doc->saveHTML());

DEMO.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top