I am running Ruby 1.8.7 with Rails 2.3.5 on Ubuntu 10.04 64-bit. I wrote a method that should take a line like this, "École À la Découverte" and print a file system name like this "ecole_a_la_decouverte" :
(Iconv.new('US-ASCII//TRANSLIT', 'utf-8').iconv "École À la Découverte").downcase.split.join('_')
When I check this line in my code, the test always fails saying that "cole_la_dcouverte" does not match "ecole_a_la_decouverte" . It is strange that if I insert a debugger line and use the debugger console, the test passes. Also, this line works manually in irb and ./script/console seems to work.
Does anyone know what is happening and why this test fails? My only thought is that turning on the debugger or irb somehow adds extra support for UTF-8, but I don’t understand where to go next.
Thanks in advance!
source share