Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/11/2008, 11:01
peconrrixico22
 
Fecha de Ingreso: mayo-2005
Mensajes: 118
Antigüedad: 19 años, 8 meses
Puntos: 0
Problema al parsear variable caracteres raros

Hola tengo una variable en php que contiene esto

Código HTML:
<p><span style="color: rgb(128, 128, 0);">This</span> is <span style="color: rgb(255, 204, 153);">some</span> <strong>sample text</strong>. You <span style="color: rgb(204, 255, 204);">are</span></p> 
cuando pongo:

Código PHP:
echo $variable
se me imprime en pantalla lo antes escrito, hasta ahora todo bien.

Mi pregunta surge cuando quiero crear un html y quiero poner el valor de esa variable, lo hago tal que asi:

Código PHP:
$xml.="<html><head><title></title></head>";
$xml.="<body>".$variable."</body></html>";

$sfile="productos.html"
$fp=fopen($sfile,"w+"); 
fwrite($fp,$xml); 
chmod("$sfile"0777);
fclose($fp); 
El programa en vez de escribirme este código:

Código HTML:
<html><head><title></title></head>
<body>
<p><span style="color: rgb(128, 128, 0);">This</span> is <span style="color: rgb(255, 204, 153);">some</span> <strong>sample text</strong>. You <span style="color: rgb(204, 255, 204);">are</span></p>
</body></html> 
Me escribe esto, una serie de caracteres raros que sustituyen a los otros ....

Código HTML:
<html><head><title></title></head>
<body>
&lt;p&gt;&lt;span style=&quot;color: rgb(128, 128, 0);&quot;&gt;This&lt;/span&gt; is &lt;span style=&quot;color: rgb(255, 204, 153);&quot;&gt;some&lt;/span&gt; &lt;strong&gt;sample text&lt;/strong&gt;. You &lt;span style=&quot;color: rgb(204, 255, 204);&quot;&gt;are&lt;/span&gt; using &lt;a href=&quot;http://www.fckeditor.net/&quot;&gt;FCKeditor&lt;/a&gt;.&lt;/p&gt;
</body></html> 

¿Como puedo conseguir que me lo escriba de la anterior forma?

Muchisimas gracias por adelantado.