I have a dom document to which I would like to append some special characters.
What I am doing is first to detect the special character in a string with a regexp. For that, I am transforming the utf-8 characters on html with
$string = "Test string 1,§,†,‡";
$string_html = htmlentities($string_html, ENT_QUOTES, "UTF-8");
This works fine and I am getting there:
"Test string 1,§,†,‡"
Now, I would like to get the special characters only. I am using for that a regexp which is returning an array with:
[0] => '§';
[1] => '&dagger';
[2] => '&Dagger';
Now, I would like to append those special characters to my dom document, but in unicode. I was trying:
$string_utf8 = html_entity_decode($string_html);
$dom_output->createElement( 'string', utf8_encode($string_utf8));
The results are the next:
The § character is displayed as §, and the † and ‡ are staying as that.
Any idea why?