Yahoo API + PHP5: "Unknown encoding utf-8"?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Philipp Lenssen

    Yahoo API + PHP5: "Unknown encoding utf-8"?

    I want to try the new Yahoo API, but I get the PHP5 error message

    Unknown encoding "utf-8"

    in the marked line below...
    (After that, applying the Xpath will fail as symptom of the first bug.)

    function showImages($q)
    {

    $image_url = 'http://api.search.yaho o.com/' .
    'ImageSearchSer vice/V1/imageSearch?' .
    'appid=YahooDem o&query=' . urlencode($q) . '&results=5';

    $dom = new domdocument; // ERROR!

    $dom->load($image_ur l);
    $xpath = new domxpath($dom);

    $xNodes = $xpath->query('//Result');
    foreach ($xNodes as $xNode)
    {
    // ...
    }
    }


    Can anyone help? I tried some encoding workarounds but nothing
    worked... note my direct file access with PHP5 is disabled on my server
    (using file() or fopen()).

    --
    Google Blogoscoped
    A daily news blog and community covering Google, search, and technology.

  • R. Rajesh Jeba Anbiah

    #2
    Re: Yahoo API + PHP5: "Unknow n encoding utf-8"?

    Philipp Lenssen wrote:[color=blue]
    > I want to try the new Yahoo API, but I get the PHP5 error message
    >
    > Unknown encoding "utf-8"[/color]
    <snip>

    This is not an answer to your question. FWIW, I did look at the SDK
    <http://developer.yahoo .net/download/download.html> and the PHP code
    written by Rasmus Lerdorf. I have the *humble opinion* that this code
    could have been written better--with better standard and style.

    --
    <?php echo 'Just another PHP saint'; ?>
    Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

    Comment

    • Philipp Lenssen

      #3
      Re: Yahoo API + PHP5: &quot;Unknow n encoding utf-8&quot;?

      R. Rajesh Jeba Anbiah wrote:
      [color=blue]
      > Philipp Lenssen wrote:[color=green]
      > > I want to try the new Yahoo API, but I get the PHP5 error message
      > >
      > > Unknown encoding "utf-8"[/color]
      > <snip>
      >
      > This is not an answer to your question. FWIW, I did look at the SDK
      > <http://developer.yahoo .net/download/download.html> and the PHP code
      > written by Rasmus Lerdorf. I have the *humble opinion* that this code
      > could have been written better--with better standard and style.
      >[/color]

      You might be right. I just posted something in my blog on that today:


      I wish there'd be a working PHP5 sample using the more modern native
      DOM/XML classes.

      Comment

      • Philipp Lenssen

        #4
        Re: Yahoo API + PHP5: &quot;Unknow n encoding utf-8&quot;?

        Philipp Lenssen wrote:
        [color=blue]
        >[color=green]
        > > Philipp Lenssen wrote:[color=darkred]
        > > > I want to try the new Yahoo API, but I get the PHP5 error message
        > > >
        > > > Unknown encoding "utf-8"[/color]
        > > <snip>
        > >[/color][/color]

        Update; I sort of solved it, with a hack:

        Comment

        Working...