Hi, I think the issue may be that the Japanese characters need to URL encoded when you are setting the $url. I'm not a PHP expert by any means, but a bit of searching turned up the following website which seems like it might have some helpful suggestions
http://us2.php.net/urlencode Happy coding, Jeff On Thu, Aug 13, 2009 at 6:34 PM, molesquirrel <[email protected]>wrote: > > I'm using the simple php example in the docs for the API and I'd like > to use a term that is in either utf8 or shift_jis (Japanese charset). > I'm a tad lost on what needs to be added to tell the API to see it as > utf-8 - right now, it appears to be translated into gibberish with 0 > results in the returned json. The php file it's loading from is > already saved with the right character-set, so that's not the > problem. > > Please let me know if any other information is required, and I > appreciate the help! > > <?php > > $term = '日本'; //not sure if you can see this, but it's two japanese > characters > > $url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q= > $term"; > > // sendRequest > // note how referer is set manually > $ch = curl_init(); > curl_setopt($ch, CURLOPT_URL, $url); > curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); > curl_setopt($ch, CURLOPT_REFERER, "http://mysitehere.com/index.html"); > $body = curl_exec($ch); > curl_close($ch); > > // now, process the JSON string > $json = json_decode($body); > echo "<pre>"; > print_r($json); > > ?> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-AJAX-Search-API?hl=en -~----------~----~----~----~------~----~------~--~---
