Problem with Iconv


Here is my code:

require ‘iconv’

result = Iconv.iconv(‘ascii//translit//IGNORE’, ‘utf-8’, “zażółć gęślÄ…
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:

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

What may causing this error? Maybe i need to install additional

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