PHP DOMDocument loadHTML not encoding UTF-8 correctly
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 = “<div><p>various japanese characters</p></div>”; $dom = new DOMDocument(); $dom->loadHTML($profile); $divs = $dom->getElementsByTagName(‘div’); foreach ($divs as $div) { echo $dom->saveHTML($div); } The result of this code is that I … Read more