youtube APIs encoding data problem

Discussion in 'PHP' started by crazy.works, Sep 22, 2008.

  1. #1
    Hello, i use the youtube APIs Gdata in my script to got the
    videos,title and the description
    so it works very good with no problems with the english words but i
    want to use it with the
    arabic videos too , when i tried to add arabic video like that one
    http://www.youtube.com/watch?v=6KgV2KYkkI4
    the title in the yotube was "سباق سيارات" and the description was "
    سباق سيارات ... سباق سيارات ... "
    so when i tried to add that file in my site i got the title encoded so
    the title became like that "سباق سيارات "
    and the description became like that "سباق سيارات "

    so here is my code , please tell me how to fix this or give me
    code that will not encode the data which didnt writen in english
    language

    <?php
    $gamefile = "6KgV2KYkkI4";

    require_once 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata_YouTube');
    $yt = new Zend_Gdata_YouTube();
    $myVideo = $yt->getVideoEntry($gamefile);
    printVideoEntry($myVideo);

    function printVideoEntry($videoEntry)
    {
    $my_title = $videoEntry->getVideoTitle() . "\n";
    $my_description = $videoEntry->getVideoDescription() . "\n";
    echo $my_title."<br>";
    echo $my_description;
    }

    ?>
     
    crazy.works, Sep 22, 2008 IP
  2. lui2603

    lui2603 Peon

    Messages:
    729
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try setting a header at the beginning of the script:
    header('Content-Type:text/html; charset=UTF-8');
    PHP:
    I dunno if UTF-8 will work.. but it's an example :/
    Hope it helps
     
    lui2603, Sep 22, 2008 IP
  3. crazy.works

    crazy.works Peon

    Messages:
    304
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It Works Thanks
     
    crazy.works, Sep 22, 2008 IP