chracter problem with rss feeds

Discussion in 'PHP' started by trichnosis, Oct 28, 2007.

  1. #1
    Hi;

    I'm publishing rss feeds on my web site.

    The web site that i'm pulling rss feeds is using uft-8 but my web site is using ISO-8859-9 .

    And I'm pulling rss with "Magpie RSS" .

    It's working good but some of characters are being ? symbol.

    Is there any way to fix this problem

    Thanks for the comments
     
    trichnosis, Oct 28, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Not my code (got it from php.net/utf8_encode)

    
    function str_encode ($string,$to="iso-8859-9",$from="utf8") {
        if($to=="iso-8859-9" && $from=="utf8"){
            $str_array = array(
           chr(196).chr(177) => chr(253),
           chr(196).chr(176) => chr(221),
           chr(195).chr(182) => chr(246),
           chr(195).chr(150) => chr(214),
           chr(195).chr(167) => chr(231),
           chr(195).chr(135) => chr(199),
           chr(197).chr(159) => chr(254),
           chr(197).chr(158) => chr(222),
           chr(196).chr(159) => chr(240),
           chr(196).chr(158) => chr(208),
           chr(195).chr(188) => chr(252),
           chr(195).chr(156) => chr(220)
           );
           return str_replace(array_keys($str_array), array_values($str_array), $string);
       
        }   
        return $string;
    }
    
    PHP:
    http://www.php.net/utf8-encode#71288
     
    nico_swd, Oct 28, 2007 IP
  3. bLuefrogx

    bLuefrogx Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    What's wrong with plain old
    utf8_decode($string)
    PHP:
    ?
     
    bLuefrogx, Oct 28, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    It decodes ISO-8859-1 and not ISO-8859-9.
     
    nico_swd, Oct 28, 2007 IP
  5. bLuefrogx

    bLuefrogx Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    My bad, didn't notice the -9
     
    bLuefrogx, Oct 29, 2007 IP