Hi, I'm editing an XML file through a form: $XML = new DOMDocument('1.0', 'UTF-8'); $XML->preserveWhiteSpace = false; $XML->load("../xml/exposiciones.xml"); $raiz = $XML->documentElement; $nodoContenedor = $XML->getElementsByTagName('texto'); foreach ($nodoContenedor as $NuevoNodo) { //titulo $nodoTitulo = $XML->createElement("p", ""$titulo""); $NuevoNodo->appendChild($nodoTitulo); $nodoTitulo->setAttribute("class", "titulo"); $NuevoNodoHijo = $XML->createElement("subtitulo", " $subtitulo"); $nodoTitulo->appendChild($NuevoNodoHijo); $raiz->appendChild($NuevoNodo); } $NodoRefTitulo = $XML->getElementsByTagName('p')->item(0); $NodoRefTitulo->parentNode->insertBefore($nodoTitulo, $NodoRefTitulo); $XML->formatOutput = true; $XML->save("../xml/exposiciones.xml"); The problem is that the special characters that I introduce through the form (á,é,ó...) corrupt the XML file, and when I try to update again the file, receipted this error: Warning: DOMDocument::load() [domdocument.load]: Input is not proper UTF-8, indicate encoding ! Bytes: 0xF3 0x6E 0x20 0x63 in........ I'd try to fix up it with the label <![CDATA[]]>, and by changing the encoding -> UTF-8, iso-8859-1 as well, here: $XML = new DOMDocument('1.0', 'UTF-8'); --> $XML = new DOMDocument('1.0', 'iso-8859-1'); and in the XML file: <?xml version="1.0" encoding="utf-8"?> ..... and also I was try: $subtitulo = str_replace("ó" , "ó", utf8_encode($subtitulo)); $subtitulo = str_replace("ó" , "ó;", utf8_encode($subtitulo)); When I open the XML file again i found an strange character between "i" and "n" exposicion (exposición): <p class="titulo">"A-foto"<subtitulo> *exposiciﻩn*colectiva.</subtitulo></p> Anyone know how to solve this problem? Thanks for your help, Te0