From: The Chromag Date: 2010-02-19T06:20:42+09:00 Subject: Re: RTranslate Gem (Open-URI) and Encoding Richard Conroy wrote: > On Thu, Feb 18, 2010 at 7:45 PM, The Chromag wrote: > > You need to specify encoding in your ruby script. Ruby (1.8 at least, I > am > not certain of 1.9) > will use your system encoding for strings by default. > > Set this constant in your script to make Ruby process strings as UTF-8, > independently of > your machine > $KCODE = 'u' > > There is more detail here: > http://blog.grayproductions.net/articles/the_kcode_variable_and_jcode_library > > Note that Ruby could be processing google translate correctly (i.e. you > are > doing everything above), > but if you are outputting the result to the console/system out (via > puts) > your machine may still > process the UTF-8 text according to the host system. This for instance > is a > particularly annoying > problem on windows systems IME. Output to a file instead if you are > seeing > this problem. I had the $KCODE variable set. It didn't seem to do anything in this case. I outputted the translated text to a file to see if it was a display issue with the console and the text was still incorrect in the file. Any other ideas? Thanks. -- Posted via http://www.ruby-forum.com/.