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?