Re: [PHP] Problem when adding special characters to an XML file

2010-07-15 Thread te0t3l
Thanks for your offer Richard, but I solved the problem deleting the UTF-8
encoding label in the XML file like this:

before: 
   

after: 


Re: [PHP] Problem when adding special characters to an XML file

2010-07-15 Thread Richard Quadling
On 15 July 2010 12:01, te0t3l  wrote:
> Hi again,
>
> Now I download the editing XML file and open it in windows with notepad and
> save with utf-8 encode, then upload the file again and can see the correct
> characters, what's the problem? I'm specifying the correct encoding when
> process the form and editing the XML file:
>
> $XML = new DOMDocument('1.0', 'UTF-8');
>
> Any idea please...
> Thanks,
>
> te0
>

Can you do a binary comparison between the 2 files (assuming you have
an original).

FC file1.xml file2.xml /b

Or can you zip them both and I can take a look at them for you (email
me directly).

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem when adding special characters to an XML file

2010-07-15 Thread te0t3l
Hi again,

Now I download the editing XML file and open it in windows with notepad and
save with utf-8 encode, then upload the file again and can see the correct
characters, what's the problem? I'm specifying the correct encoding when
process the form and editing the XML file:

$XML = new DOMDocument('1.0', 'UTF-8');

Any idea please...
Thanks,

te0


[PHP] Problem when adding special characters to an XML file

2010-07-14 Thread te0t3l
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 , 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:

 .

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):

"A-foto" *exposiciﻩn*colectiva.


Anyone know how to solve this problem?

Thanks for your help,

Te0