PHP DOMDocument loadHTML not encoding UTF-8 correctly

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

    The problem is that when you add a parameter to DOMDocument::saveHTML() function, you lose the encoding. In a few cases, you'll need to avoid the use of the parameter and use old string function to find what your are looking for.

    I think the previous answer works for you, but since this workaround didn't work for me, I'm adding that answer to help people who may be in my case.

提交回复
热议问题