# Problem with Iconv

**URL:** <https://rubytalk.org/t/problem-with-iconv/55082>\
**Category:** ruby-talk\
**Created:** [26 August 2009 14:56 UTC](https://rubytalk.org/t/problem-with-iconv/55082 "2009-08-26T14:56:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joao\_Silva](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@Joao\_Silva](https://rubytalk.org/u/Joao_Silva)\
**Post date:** [26 August 2009 14:56 UTC](https://rubytalk.org/t/problem-with-iconv/55082/1 "2009-08-26T14:56:28Z")

</div>

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?

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
