- Home
- Categorie
- Coding e Sistemistica
- CMS & Piattaforme Self-Hosted
- AIUTO!! Carattere "virgolette" in feed
- 
							
							
							
							
							
AIUTO!! Carattere "virgolette" in feedsapreste aiutarmi per risolvere un problema con la lettura del feed in wordpress?? Ecco lo script che legge i feed di wordpress ma nei TITOLI al posto del carattere " cioè le virgolette, stampa a video il ? punto interrogativo, potete copiarvi il codice e metterlo in locale: **<?php 
 $rssurl="http://www.angelweb.it/news/rss/";
 class xml {
 var $parser;
 function parse($xmlstring){
 $this->parser = xml_parser_create();
 xml_set_object($this->parser, $this);
 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
 xml_set_element_handler($this->parser, "tag_open", "tag_close");
 xml_set_character_data_handler($this->parser, "cdata");$this->node_stack = array(); 
 $this->tag_open(null, "root", array());xml_parse($this->parser, $xmlstring); 
 xml_parser_free($this->parser);$rnode = array_pop($this->node_stack); 
 return($rnode);
 }function tag_open($parser, $tag, $attributes){ 
 // Creazione di un nuovo nodo
 $node = array();
 $node["_NAME"] = $tag;
 foreach ($attributes as $key => $value) {
 $node[$key] = $value;
 }
 $node["_DATA"] = "";
 $node["_ELEMENTS"] = array();array_push($this->node_stack, $node); 
 }function cdata($parser, $cdata){ 
 $lastnode = count($this->node_stack);
 $this->node_stack[$lastnode-1]["_DATA"] .= $cdata;
 }function tag_close($parser, $tag){ 
 $node = array_pop($this->node_stack);
 $node["_DATA"] = trim($node["_DATA"]);
 $lastnode = count($this->node_stack);
 array_push($this->node_stack[$lastnode-1]["_ELEMENTS"], $node);
 }
 }//inizio del codice $fp = fopen($rssurl, "r"); 
 while (!feof ($fp)) $data .= fgets($fp, 4096);
 fclose ($fp);
 $initPos = strpos($data, "<channel>");$xml_parser = new xml(); 
 $data = substr($data, $initPos);
 $root_node = $xml_parser->parse($data);
 $channel = array_shift($root_node["_ELEMENTS"]);foreach ($channel["_ELEMENTS"] as $item){ 
 if($item[_NAME]=="title") $base_name=stripslashes($item[_DATA]);
 if($item[_NAME]=="link") $base_url=stripslashes($item[_DATA]);
 if($item[_NAME]=="description") $base_desc=stripslashes($item[_DATA]);
 }$i=0; 
 foreach ($channel["_ELEMENTS"] as $item){
 if($item[_NAME]=="item") {
 foreach ($item["_ELEMENTS"] as $tag){
 if($tag["_NAME"]=="title") $news_title=stripslashes($tag[_DATA]);
 if($tag["_NAME"]=="link") $news_url=stripslashes($tag[_DATA]);
 if($tag["_NAME"]=="pubDate") $news_pubDate=stripslashes($tag[_DATA]);
 if($tag["_NAME"]=="description") $news_desc=stripslashes($tag[_DATA]);
 if($tag["_NAME"]=="category") $news_cat=stripslashes($tag[_DATA]);
 $news_cat_link=strtolower($news_cat);
 }
 //codice di impaginazione delle news
 $news* = "<div class="feed"><font size="1">$news_pubDate<br><b><a href="$news_url" target="_top">$news_title</a></b>";
 $i++;
 }
 }
 $NumTotNews=$i;
 $col=0;
 echo "<table border=0 cellspacing=2 cellpadding=0 width=140>";
 echo "<tr>";
 for ($k=0;$k<$NumTotNews;$k++) {
 echo "{$news[$k]}";
 $col++;if ($col==1) { 
 echo "</tr><tr>";
 $col=0;
 }} 
 echo "</tr>";
 echo "</table>";?> 
 <?php print($base) ?>**Ho provato a guardare il codice del file wp-rss2.php e wp-rss.php e non cè nulla di particolare nella lettura. Grazie  
 
- 
							
							
							
							
							
Il ? è come questo? � Se si probabilmente è un problema di codifica del testo, controlla che sia coerente con quella del DB. 
 
- 
							
							
							
							
							
@gh3 said: Il ? è come questo? � Se si probabilmente è un problema di codifica del testo, controlla che sia coerente con quella del DB. No, è proprio ?. Guarda lo puoi guardare nel footer nel mio sito www.angelweb.it e vedrai che i titoli delle NEWS (in alcuni) che hanno il carattere " virgolette, mostrano il punto interrogativo. Grazie 
 
- 
							
							
							
							
							
boh io vedo tutti con "  
 
- 
							
							
							
							
							
Ragazzi davvero non sapete come risolvere questo mio problemino???? 
 Il fatto è che esteticamente non si può vedere!!Dai che ce la facciamo.. 
 
- 
							
							
							
							
							
Questo problema si visualizza solo sui TITLE titoli dei post e non sulla medesima descrizione. 
 I caratteri àèùò si leggono bene ma i caratteri " / ' si leggono tutti con ? punto interrogativo.Allora proprio nessuno sa da cosa dipende in wordpress?? 
 
- 
							
							
							
							
							Forse risolvi forse no prova con questo plugin 
 http://anthologyoi.com/wordpress/plugins/wordpress-charecter-map.html
 
- 
							
							
							
							
							
@pierfrancesco99 said: Forse risolvi forse no prova con questo plugin 
 http://anthologyoi.com/wordpress/plugins/wordpress-charecter-map.htmlProvato grazie, ma non è un problema di encoding ma del lettore. 
 Comunque ho risolto prendendo un'altro lettore e ora funge benissimo.Grazie per la disponibilità. 