PHP DOMDocument does not keep numeric presentation of HTML special characters -


i have domdocument , append nodes.

in 1 of nodes, put:

$copyrightstatementtext = "© copyright"; 

the problem function:

$copyrightstatement = $dom_output->createelement('copyright-statement', $copyrightstatementtext); 

is converting © ©.

my goal keep ©

any idea how that?

from domdocument::createelement():

note: value not escaped. use domdocument::createtextnode() create text node escaping support.

so use domdocument::createtextnode() instead:

$copyrightstring = "© copyright"; $copyrightnode = $dom_output->createtextnode($copyrightstring); $copyrightcontainer = $dom_output->createelement('copyright-statement');  $copyrightcontainer->appendchild($copyrightnode); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -