DomDocument and special characters

后端 未结 8 1468
轮回少年
轮回少年 2020-12-14 16:47

This is my code:

$oDom = new DOMDocument();
$oDom->loadHTML(\"èàéìòù\");
echo $oDom->saveHTML();

This is the output:

         


        
8条回答
  •  攒了一身酷
    2020-12-14 17:06

    The issue appears to be known, according to the user comments on the manual page at php.net. Solutions suggested there include putting

    
    

    in the document before you put any strings with non-ASCII chars in.

    Another hack suggests putting

    
    

    as the first text in the document and then removing it at the end.

    Nasty stuff. Smells like a bug to me.

提交回复
热议问题