Using globalize and Net::HTTP.get

Today we did some cool stuff with globalize (the library) and
Net::HTTP.get. I thought it was pretty awesome, but most people I talked
to really didn’t think so, so I’ve come here to share my excitement on
this list w/ ppl who’d understand :stuck_out_tongue:

Anyways, we took globalize and extended it so that websites were
translated on the fly by Google Translate / Babelfish type services out
there when someone switched the locale to something Google could
translate, and there was no entry in the db. (Maybe it should be an add
on to globalize)

The translation was horrible, but it was a fun hack.

One problem I didn’t get over forever which no one seemed to be able to
help me with is that the content from Net::HTTP.get is not in UTF-8
form. To convert this, you must use .toutf8 on the string object. It was
simple, but I spent almost a whole day on this, so I document it here
for posterity, in case anyon else ever runs into it.

Here are the details. I figured you guys would be interested in it.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs