Forum: Rails I18n Problem with Iconv

8d1abb557a221370f99faf31f4953f82?d=identicon&s=25 James Red (rubyforum)
on 2009-08-25 21:17
Hello!

Here is my code:

require 'iconv'

result = Iconv.iconv('ascii//translit//IGNORE', 'utf-8', "zażółć gęślą
jaźń")
puts result.to_s.gsub(/[^\x00-\x7F]+/, '').gsub(/[^\w_ \-]+/i,   '')

Result (Mac OS X Leopard):

code/Rails/x[master]% port list | grep iconv
libticonv                      @1.1.0          math/libticonv
p5-text-iconv                  @1.4            perl/p5-text-iconv
libiconv                       @1.12           textproc/libiconv
code/Rails/x[master]% ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]
code/Rails/x[master]% ruby test.rb
zazolc gesla jazn

This is what I want, but on my production (Ubuntu) machine i get much
different result:

rails@li103-32:~$ dpkg -l | grep iconv
ii  libtext-iconv-perl                1.7-1build1
converts between character sets in Perl
rails@li103-32:~$ ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-linux]
Ruby Enterprise Edition 20090610
rails@li103-32:~$ ruby test.rb
za gl ja

What may causing this error? Maybe i need to install additional
packages?
This topic is locked and can not be replied to.