# Google Ajax Search API - UTF-8 encoded response

**URL:** <https://www.ruby-forum.com/t/google-ajax-search-api-utf-8-encoded-response/136300>\
**Category:** Rails\
**Created:** [April 30, 2008, 4:16pm UTC](https://www.ruby-forum.com/t/google-ajax-search-api-utf-8-encoded-response/136300 "2008-04-30T16:16:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9de0a6/32.png) [@prasad](https://www.ruby-forum.com/u/prasad)\
**Post date:** [April 30, 2008, 4:16pm UTC](https://www.ruby-forum.com/t/google-ajax-search-api-utf-8-encoded-response/136300/1 "2008-04-30T16:16:17Z")

</div>

Hello All,

I am writing a facebook application in ruby on rails, which requires  
google search in one page.  
I’ve implemented this using a simple RESTful interface as follows:

url = URI.parse( “[http://ajax.googleapis.com/ajax/services/search/](http://ajax.googleapis.com/ajax/services/search/)  
local?v=1.0&q=”+params[:keyword] )  
req = Net::HTTP::Get.new(url.path+“?”+url.query)  
res = Net::HTTP.start(url.host, url.port) {|http|  
http.request(req) }

The response has a Content-Type of text/javascript; charset=utf-8. and  
in JSON format

So, I’m decoding the response into a hash as  
hash = ActiveSupport::JSON.decode(res.body)

But, the data still contains some special characters starting with \u  
(utf-8 characters)

How to decode them into html text in ruby?

Thanks in Advance,  
Prasad

---

<div class="post-metadata">

**Author:** ![prasad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9de0a6/32.png) [@prasad](https://www.ruby-forum.com/u/prasad)\
**Post date:** [May 1, 2008, 8:24am UTC](https://www.ruby-forum.com/t/google-ajax-search-api-utf-8-encoded-response/136300/2 "2008-05-01T08:24:39Z")

</div>

Hello Everybody,

Is there anything like Unicode.deocode(str) (I found it somewhere when  
I googled, but not working )??  
I have installed unicode using gem install unicode, but couldn’t get  
how to use it.

Please please help me out solving this problem.

Thanks,  
Prasad
