From: Russell Norris Date: 2007-09-03T20:28:25+09:00 Subject: Re: Inconsistent results using Iconv I just realized that I didn't really ask a question there, did I?Woops. I'd like to know what I'm doing wrong or perhaps just how to doit right so that I get the same results. Do I need to manually includeanother library that somehow isn't getting included in the other waysI've tried? I'd really like to be able to count on my Iconv.iconv codedoing what I need all the time but it seems I can't at the moment. :( Here's hoping someone can help me solve this puzzle. RSL On 9/2/07, Russell Norris wrote:> Howdy. I'm working with Iconv and discovered that this code>> require "iconv"> ["��gis", "stra��e", "kierkeg��rd", "jo��o", "bj��rk"].each do |word|> puts "#{word} => #{Iconv.iconv('ascii//translit', 'utf-8', word)}"> end>> generates different results depending on how the code is loaded.> "��gis" and "stra��e" convert fine no matter how they're called but> "kierkeg��rd" and "jo��o" only convert correctly when loaded or typed or> pasted within an open instance of irb. Sadly, poor "bj��rk" never> manages to get correctly converted. At the bottom of the email, I have> pasted the results of the various methods I've tried to run this code.>> Note: The last attempt I show below apparently _does_ work for a> friend of mine using Fedora 7. Just more weirdness? I dunno. My mind's> reeling. Time for a break. ;)>> Thanks in advance,>> RSL>> Here's the various code runs...>> rsl@sneaky ~ > irb> irb(main):001:0> load "omg.rb"> ��gis => aegis> stra��e => strasse> kierkeg��rd => kierkegard> jo��o => joao> bj��rk => bj?rk>> rsl@sneaky ~ > ./omg.rb> ��gis => aegis> stra��e => strasse> kierkeg��rd => kierkeg?rd> jo��o => jo?o> bj��rk => bj?rk>> rsl@sneaky ~ > ruby omg.rb> ��gis => aegis> stra��e => strasse> kierkeg��rd => kierkeg?rd> jo��o => jo?o> bj��rk => bj?rk>> rsl@sneaky ~ > irb omg.rb> omg.rb(main):001:0> #!/usr/bin/env ruby> omg.rb(main):002:0* require "iconv"> => true> omg.rb(main):003:0> ["��gis", "stra��e", "kierkeg��rd", "jo��o",> "bj��rk"].each do |word|> omg.rb(main):004:1* puts "#{word} =>> #{Iconv.iconv('ascii//translit', 'utf-8', word)}"> omg.rb(main):005:1> end> ��gis => aegis> stra��e => strasse> kierkeg��rd => kierkeg?rd> jo��o => jo?o> bj��rk => bj?rk> => ["\303\246gis", "stra\303\237e", "kierkeg\303\245rd",> "jo\303\243o", "bj\303\270rk"]> omg.rb(main):006:0> exit>> rsl@sneaky ~ > cat omg.rb | irb> #!/usr/bin/env ruby> require "iconv"> true> ["��gis", "stra��e", "kierkeg��rd", "jo��o", "bj��rk"].each do |word|> puts "#{word} => #{Iconv.iconv('ascii//translit', 'utf-8', word)}"> end> ��gis => aegis> stra��e => strasse> kierkeg��rd => kierkeg?rd> jo��o => jo?o> bj��rk => bj?rk> ["\303\246gis", "stra\303\237e", "kierkeg\303\245rd", "jo\303\243o",> "bj\303\270rk"]> exit>