Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

nggggh! I know the answer to this is simple. Euro sign problems...

  • 14-09-2006 9:22pm
    #1
    Business & Finance Moderators, Entertainment Moderators Posts: 32,387 Mod ✭✭✭✭


    I have a blog for poker news at
    http://www.antesup.com/news/blog/3
    and the euro signs are showing nicely there.

    I use the RSS feed from this blog to power a webpage. The feed is at:
    http://www.antesup.com/news/blog/3/feed
    Which also shows the Euro signs correctly. So far so hoopy.

    But the page it is taken into (via MagpieRSS if that makes any difference)is here:
    http://www.antesup.com/gjpnews.php
    and it shows ?'s instead of euro signs.

    Now, I immediately checked the charset and found it was Western European... ok so I changed that to UTF-8 and figured that would solve it. But it hasnt.

    So, anyone got any words of wisdom for me? I'm bad with charsets but I just know Jon Hanna or someone knows this off the top of their heads...


    Thanks for any suggestions,
    DeV.


Comments

  • Closed Accounts Posts: 119 ✭✭frodo_dcu


    i don't think its a charset problem. magpieRSS is for parsing RSS 1.0 (and earlier versions) where as your feed is RSS 2.0 I think its simply a case of magpie not parsing it correctly and acctully turniing the €'s into ?'s as opposed to them showing up like that

    try maybe http://simplepie.org/ i hear its good


  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    I don't think it's a RSS version issue. RSS2.0 is backwards compatible with the 0.91 branch of RSS versions. It's a sucky standard in many ways, but probably not the culprit here.

    Certainly looks like a charset issue to me. Blog looks like perfectly okay UTF-8 with € in it. Output looks like perfectly okay UTF-8 with ? in it (it's not even the ? some machines will display for characters it can't render, it's an actual ? in the HTML), most likely therefore something in the middle - either the RSS parser or the script writing the output, I'd put my money on the script - can't handle UTF-8 correctly.

    If you could force the RSS to have € or € instead of €, AND if the RSS2HTML script didn't try to be too clever with those character entities and just passed them through untouched, then you should be grand.

    One possibility is if you could force the feed to be in US-ASCII, and the feed producing software did the right thing when doing so (i.e. turning characters that aren't in the US-ASCII range into entities). Worth a shot.

    Possibly Magpie is doing its job okay, but your PHP isn't. Quite likely in fact, since PHP was originally extremely bad in this regard, and needs coaxing to do the right thing. It could either be a matter of making sure PHP is set to deal with the charset correctly (don't ask me, haven't used PHP much), or of forcing the input to ASCII with escapes for characters outside of that range (gah!) or rolling your own string-handling functions (have had to do that in ASP for an app. that was on a shared box where I couldn't change the settings, tedious but not difficult).


  • Registered Users, Registered Users 2 Posts: 2,170 ✭✭✭Serbian


    It looks like the € signs aren't being escaped to € like all the other HTML entities. That is where the problem lies in my opinion. In PHP, htmlentities doesn't escape the euro sign, so it poses a slight problem as you have to escape the character some other way. A simple function like so would do it:

    [php]<?php
    function customHTMLentities ($str) {
    $find = array ('€');
    $replace = array ('€');
    $str = str_replace ($find, $replace, htmlentities($str));
    return $str;
    }
    ?>[/php]


  • Registered Users, Registered Users 2 Posts: 673 ✭✭✭Bananna man


    Is it easy to set up an RSS feed. is it just a csae of copy the RSS code into my html document or is their alot more i'd have to look into?


  • Business & Finance Moderators, Entertainment Moderators Posts: 32,387 Mod ✭✭✭✭DeVore


    Its a lot more complex then that Banana. You need something like MagpieRSS installed on your server and then use a piece of simple code to chop up the RSS feed.

    The code we use on this page is this:
    
            require_once("magpierss/rss_fetch.inc");
            //define('MAGPIE_CACHE_DIR', '/home/antesup/public_html/magpierss/cache');
    
            $rss_url = "http://www.antesup.com/news/?q=blog/3/feed";
            $rss = fetch_rss($rss_url);
            $counter = 0;
            foreach ($rss->items as $item) {
                    $counter++;
                    $href = $item['link'];
                    $title = $item['title'];
    		$description = $item['description'];
    		$pubdate = $item['pubdate'];
                   echo "<span class=\"style38\">".$title."</span>";
                   echo "<span class=\"style53\">".$description."</span><br>\n";
                    if ($counter > 10) { break; }
            }
    

    DeV.


  • Advertisement
  • Business & Finance Moderators, Entertainment Moderators Posts: 32,387 Mod ✭✭✭✭DeVore


    More info (and a partial fix!).

    When using Drupal to enter the test, I put in &euro instead of using the normal keystroke and it was passed through fine.

    Dunno if that help id the problem but we can live with it if it can't be easily fixed.
    Thanks for the help guys, it put me on the road to that workaround!

    DeV.


  • Registered Users, Registered Users 2 Posts: 673 ✭✭✭Bananna man


    DeVore wrote:
    Its a lot more complex then that Banana. You need something like MagpieRSS installed on your server and then use a piece of simple code to chop up the RSS feed.

    The code we use on this page is this:
    
            require_once("magpierss/rss_fetch.inc");
            //define('MAGPIE_CACHE_DIR', '/home/antesup/public_html/magpierss/cache');
    
            $rss_url = "http://www.antesup.com/news/?q=blog/3/feed";
            $rss = fetch_rss($rss_url);
            $counter = 0;
            foreach ($rss->items as $item) {
                    $counter++;
                    $href = $item['link'];
                    $title = $item['title'];
    		$description = $item['description'];
    		$pubdate = $item['pubdate'];
                   echo "<span class=\"style38\">".$title."</span>";
                   echo "<span class=\"style53\">".$description."</span><br>\n";
                    if ($counter > 10) { break; }
            }
    

    DeV.

    Thanks for that, do you have the code for the function "fetch_rss" so i can have a look at that too.

    Cheers


  • Business & Finance Moderators, Entertainment Moderators Posts: 32,387 Mod ✭✭✭✭DeVore


    I've attached it...

    DeV.


  • Business & Finance Moderators, Entertainment Moderators Posts: 32,387 Mod ✭✭✭✭DeVore


    trying this attachment thing one more time...

    It should be a .inc but I've changed it to .txt to attach it.

    DeV.


  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    You give Serbian's code a try? (possibly changing the € to the PHP escape thereof if it doesn't work as written). He seems to be on the money here.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 673 ✭✭✭Bananna man


    DeVore wrote:
    trying this attachment thing one more time...

    It should be a .inc but I've changed it to .txt to attach it.

    DeV.

    Thanks for the file. I've never heard about this Magpie thing, is that just a php plugin? Am i way over my head here or is it possible for me to get this thing setup without too much hassle?


Advertisement