PHP DOMDocument loadHTML not encoding UTF-8 correctly

后端 未结 13 1714
梦如初夏
梦如初夏 2020-11-22 15:11

I\'m trying to parse some HTML using DOMDocument, but when I do, I suddenly lose my encoding (at least that is how it appears to me).

$profile = \"

        
13条回答
  •  [愿得一人]
    2020-11-22 15:42

    You must feed the DOMDocument a version of your HTML with a header that make sense. Just like HTML5.

    $profile =''. $html;
    

    maybe is a good idea to keep your html as valid as you can, so you don't get into issues when you'll start query... around :-) and stay away from htmlentities!!!! That's an an necessary back and forth wasting resources. keep your code insane!!!!

提交回复
热议问题