From: Wilson Bilkovich Date: 2005-12-14T23:36:40+09:00 Subject: Re: Iconv weirdness on Windows XP On 12/14/05, Dave Burt wrote: > I wrote just before: > > My best guess is that it's an incompatibility problem between One-Click's > > ruby core and iconv.so from the ruby-mswin32 package. > > OK, so Nobu's confirmed this. (Thanks, Nobu.) > > Meanwhile: > > > It shouldn't be Iconv::IllegalSequence - that's a "bad character" in the > > "from" string. There's an exception defined in the library, > > Iconv::InvalidEncoding - that makes sense, but apparently isn't used here. > > The solution may be to use that instead of Errno. > > > > I haven't seen Errno::EINVAL thrown by iconv, although that's what > > ruby-mswin32-1.8.2 does in this situation. And it doesn't crash. > > ruby-mswin32 1.8.4 preview 1 actually throws InvalidEncoding in this case, > and this version of iconv.so doesn't demonstrate this crashing bug with > One-Click Installer 1.8.2-15 (which I assume we're all using). > > Should I update my Iconv for One-Click package to use this new version? I'm > concerned about potential incompatibility issues between it and Ruby 1.8.2. > > In any case, you can get this version of iconv.so from in this zip: > ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/ruby-1.8.4-preview1-i386-mswin32.zip > > > Wilson Bilkovich wrote: > >> Specifically, the code that freaks out is: > >> def convert_to(text, to, from) > >> ... > >> rescue Iconv::IllegalSequence, Errno::EINVAL > > So this test fixture is still going to fail. It will need to be updated like > so: > -rescue Iconv::IllegalSequence, Errno::EINVAL > +rescue Iconv::IllegalSequence, Iconv::InvalidEncoding > Cool. Thank you for this. I replaced my iconv.so file with the one from the zip file above, and as you predicted, things now work this way: C:\ruby\lib\ruby\gems\1.8\gems\actionmailer-1.1.5\test>ruby mail_service_test.rb Loaded suite mail_service_test Started .......F...................................... Finished in 0.453 seconds. 1) Failure: test_decode_message_with_unknown_charset(ActionMailerTest) [mail_service_test.rb:718]: Exception raised: Class: Message: <"invalid encoding (\"utf-8\", \"X-UNKNOWN\")"> ---Backtrace--- ./../lib/action_mailer/vendor/tmail/quoting.rb:82:in `iconv' ./../lib/action_mailer/vendor/tmail/quoting.rb:82:in `convert_to' ./../lib/action_mailer/vendor/tmail/quoting.rb:17:in `unquoted_body' ./../lib/action_mailer/vendor/tmail/quoting.rb:43:in `body' mail_service_test.rb:718:in `test_decode_message_with_unknown_charset' mail_service_test.rb:718:in `assert_nothing_raised' mail_service_test.rb:718:in `test_decode_message_with_unknown_charset' --------------- 46 tests, 137 assertions, 1 failures, 0 errors Time for a change to that 'rescue' clause, I'd say. Thanks, --Wilson.