Foros del Web » Programación para mayores de 30 ;) » Programación General »

Caracteres html y xml

Estas en el tema de Caracteres html y xml en el foro de Programación General en Foros del Web. Hola, Signos como Ñ, ¿, ¡ o las Tildes se visualizan en Xml (Feedburner) por sus Nombres en vez de cómo signos. (Ej.: La Ñ ...
  #1 (permalink)  
Antiguo 09/02/2012, 07:45
 
Fecha de Ingreso: junio-2009
Mensajes: 76
Antigüedad: 14 años, 10 meses
Puntos: 0
Caracteres html y xml

Hola,

Signos como Ñ, ¿, ¡ o las Tildes se visualizan en Xml (Feedburner) por sus Nombres en vez de cómo signos. (Ej.: La Ñ se lee como Ntilde. La palabra “antaño” se lee como “antantildeo”).

Estos son los códigos que he encontrado en el archivo rss.php de mi web que pueden estar relacionados:

¿Qué debería que quitar/modificar?

Código:
function seo_clean_titles_rss($title)
{
	$title = str_replace("quot;", "", $title);
	$title = str_replace ( array ('À', 'à', 'Á', 'á', 'ý', 'Ý', 'È', 'è', 'É', 'é', 'Ì', 'ì', 'Í', 'í', 'Ñ', 'ñ', 'Ò', 'ò', 'Ó', 'ó', 'Ù', 'ù', 'Ú', 'ú', 'Ü', 'ü', 'Ã', '³', 'æ', 'þ', 'á', 'ð', '¨', 'ö', 'Ö'), array ( 'A', 'a', 'A', 'a', 'y', 'Y', 'E', 'e', 'E', 'e', 'I', 'i', 'I', 'i', 'N', 'n', 'O', 'o', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'o', '', 'ae', 'th', 'a', 'd', 'o', 'o', 'O'), $title);
	$title = str_replace("&", "&", $title);
    $title = preg_replace("/&([a-z]+);/", "", $title); 
    $title = str_replace(array(":", "?", "!", "$", "^", "*", ",", ";", "'", '"', "%", "~", "@", "#", "[", "]", "<", ">", "\\", "/", "=", "+"), "", $title);
    $title = str_replace(array("&"), array("und"), $title);
    $title = htmlentities($title,ENT_COMPAT,'utf-8');
    $title = str_replace ( array ('&auml;', '&ouml;', '&uuml;', '&szlig;'), array ( 'ae', 'oe', 'ue', 'ss'), $title);
    $title = preg_replace("/&([a-z]+);/", "", $title); 
	return "$title";
}

Código:
header("Content-Type: text/xml"); 
header("Expires: 0"); 
print "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"; 
print "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">";
print "<channel>\n"; 
print "<atom:link href=\"$pagelink\" rel=\"self\" type=\"application/rss+xml\" />";
print "<title>".$showtitle." - ".stripslashes($config['site_name'])."</title>\n"; 
print "<link>$pagelink</link>\n"; 
print "<description>".$showtitle."</description>\n";

Código:
$db=mysql_connect ($DBHOST,$DBUSER,$DBPASSWORD) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ($DBNAME); 
@mysql_query("SET NAMES 'UTF8'");
$result = mysql_query($query) or die ('Query Error: ' . mysql_error()); 
while ($results = mysql_fetch_array($result)) 
{ 
  $link       = $config['baseurl']."/text/".$results['PID'];
  $description = str_replace ("&amp","",htmlspecialchars(stripslashes($results['story']))); 
	print "<item>\n"; 
	print "  <title>".limit_rss(seo_clean_titles_rss($description))."</title>\n";
	print "  <link>".$link."</link>\n";
	print "  <guid>".$link."</guid>\n"; 
	print "  <description>\n"; 
	print "    <![CDATA["; 
	print seo_clean_titles_rss($description)."<br>";

Muchas gracias.

Última edición por Carlen8; 09/02/2012 a las 08:29
  #2 (permalink)  
Antiguo 09/02/2012, 13:07
Avatar de Carlangueitor
Moderador ლ(ಠ益ಠლ)
 
Fecha de Ingreso: marzo-2008
Ubicación: México
Mensajes: 10.037
Antigüedad: 16 años, 1 mes
Puntos: 1329
Respuesta: Caracteres html y xml

Ya tienes un tema abierto aquí: http://www.forosdelweb.com/f4/refere...l-html-973890/

No está permitido abrir dos hilos con el mismo tema.

Cierro el tema.

Saludos
__________________
Grupo Telegram Docker en Español

Etiquetas: caracteres, html, visual, xml
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Tema Cerrado




La zona horaria es GMT -6. Ahora son las 01:05.