I use this function to complete my HTML.

```
function correct_html($string) {
    $dom = new \DOMDocument;
    $dom->loadHTML($string);

    $mock = new \DOMDocument;
    $body = $dom->getElementsByTagName('body')->item(0);
    foreach ($body->childNodes as $child) {
        $mock->appendChild($mock->importNode($child, true));
    }

    return trim($mock->saveHTML());
}

```

But when i use this function with an é or any other special characters it's giving me Ã©. How can i fix this