php problem with russian language

前端 未结 3 1591
野趣味
野趣味 2021-01-03 10:45

i get page in utf-8 with russian language using curl. if i echo text it show good. then i use such code

$dom = new domDocument; 

        /*** load the html          


        
3条回答
  •  臣服心动
    2021-01-03 11:42

    The DOM cannot recognize the HTML's encoding. You can try something like:

    $doc = new DOMDocument();
    $doc->loadHTML('' . $html);
    
    // taken from http://php.net/manual/en/domdocument.loadhtml.php#95251
    

提交回复
热议问题