Iconv translit working in every situation… but the running app!

Hi all,

I scourged the web, including this ML's archives, and did not find an answer for this.

I have the following code in my Rails app:

require 'iconv'
     @@converter = Iconv.new('ASCII//TRANSLIT', 'UTF-8')
       result = @@converter.iconv(text.to_s).downcase

Now, the facts:

* Inbound text is indeed valid UTF-8
* Transliteration works fine in the following situations:
   * Same box, irb, my user or the Rails app's user
   * Same box, ruby interpreter, my user or the Rails app's user
   * Same box, *ruby script/console production*!!!

And yet, despite running fine in the production-mode Rails console, it b0rks within the running Rails app.

I tried dumping the environments in the Rails app and the production console, and they're just identical. No difference in traditional iconv factors such as LANG or LC_xxx variables, for instance.

Perhaps a note of importance: this DOES work on my dev box:

   OSX 10.4, libiconv 1.9.1-11 through Fink, ruby 1.8.6, Rails 1.2.6

However, this b0rks on my stage server:

   Debian Etch, iconv (libc) 2.3.6, libiconv-ruby 1.8.2, ruby 1.8.5,
   Rails 1.2.6

...and on my production server:

   RHEL5, iconv (libc) 2.5, ruby 1.8.6, Rails 1.2.6 (frozen in vendor)

I'm at a loss here! Any idea?


I am having a very similar issue, but Rails just hangs and I have to
kill -9 mongrel. My line is doing this:

Iconv.conv("utf-8", "ISO-8859-1", input_line)