PHP DOMDocument loadHTML not encoding UTF-8 correctly

后端 未结 13 1533
梦如初夏
梦如初夏 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:35

    Make sure the real source file is saved as UTF-8 (You may even want to try the non-recommended BOM Chars with UTF-8 to make sure).

    Also in case of HTML, make sure you have declared the correct encoding using meta tags:

    
    

    If it's a CMS (as you've tagged your question with Joomla) you may need to configure appropriate settings for the encoding.

提交回复
热议问题