Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

framework crashes on launch 'iconv': invalid encoding ("ascii//translit//IGNORE", "utf-8") (Iconv::InvalidEncoding)

#1195

After moving to edge rails on a OS X 10.4 machine, script/server throws the error iconv': invalid encoding ("ascii//translit//IGNORE", "utf-8") (Iconv::InvalidEncoding) on launch.

The function in question reads as follows:

# Replaces accented characters with their ascii equivalents.
def transliterate(string)
  Iconv.iconv('ascii//translit//IGNORE', 'utf-8', string).to_s
end

The problem is resolved by switching the order of the arguments like this:

Iconv.iconv('ascii//ignore//translit', 'utf-8', string).to_s

That format starts on both Tiger and Leopard, whereas the current syntax in edge rails only starts on Leopard.

The ruby version on the machine that fails is 1.8.6 (2008-08-11 patchlevel 287). The IConv class passes through to an external library though, so the version of that is probably at issue

The stack dump is as follows: /Users/Cris/Documents/Aptana Studio/insights/vendor/rails/activesupport/lib/active_support/inflector.rb:276:in iconv': invalid encoding ("ascii//translit//IGNORE", "utf-8") (Iconv::InvalidEncoding)

    from /Users/Cris/Documents/Aptana Studio/insights/vendor/rails/activesupport/lib/active_support/inflector.rb:276:in `transliterate'
    from /Users/Cris/Documents/Aptana Studio/insights/vendor/rails/activesupport/lib/active_support/inflector.rb:281
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
    from /Users/Cris/Documents/Aptana Studio/insights/vendor/rails/activesupport/lib/active_support.rb:26
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
    from /Users/Cris/Documents/Aptana Studio/insights/vendor/rails/railties/lib/commands/server.rb:1
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
    from script/server:3

Reported by James Kebinger · October 8th, 2008 @ 10:52 PM

State: committed
Milestone: none
Assigned to: Michael Koziarski Michael Koziarski
Importance: none

Activity

  1. James Kebinger
    James Kebinger
    • Title changed from crash on server launch `iconv': invalid encoding ("ascii//translit//IGNORE", "utf-8") (Iconv::InvalidEncoding) to server crashes on launch 'iconv': invalid encoding ("ascii//translit//IGNORE", "utf-8") (Iconv::InvalidEncoding)

    October 8th, 2008 @ 10:53 PM

  2. Rob Anderton
    Rob Anderton
    • Tag changed from 2.2, encoding, iconv, inflector, invalid to 2.2, bug, encoding, iconv, inflector

    I'm getting the same with Edge on Windows XP with Ruby 1.8.6 and iconv 1.9. It doesn't just stop the server from working, anything that uses the framework (e.g. rake tasks) also breaks.

    The fix suggested by James works on Windows too.

    October 14th, 2008 @ 10:31 AM

  3. Rob Anderton
    Rob Anderton
    • Title changed from server crashes on launch 'iconv': invalid encoding ("ascii//translit//IGNORE", "utf-8") (Iconv::InvalidEncoding) to framework crashes on launch 'iconv': invalid encoding ("ascii//translit//IGNORE", "utf-8") (Iconv::InvalidEncoding)

    October 14th, 2008 @ 10:33 AM

  4. Pratik
    Pratik
    • Assigned user set to Michael Koziarski
    • Milestone cleared.

    October 14th, 2008 @ 01:43 PM

  5. Repository
    Repository
    • State changed from new to resolved

    (from [e0993c6c376d62716757a8a7f476ed0c369d0fc7]) Reverse the order of the iconv arguments to remain compatible with older rubies / iconvs.

    [#1195 framework crashes on launch 'iconv': invalid encoding ("ascii//translit//IGNO... state:resolved] http://github.com/rails/rails/co...

    October 14th, 2008 @ 08:25 PM

  6. Repository
    Repository
    • State changed from resolved to committed

    (from [757e4364dc3f808f0002a6c8cb03531e69e2f356]) Fix: counter_cache should decrement on deleting associated records.

    [#1195 framework crashes on launch 'iconv': invalid encoding ("ascii//translit//IGNO... state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...

    December 10th, 2008 @ 07:05 PM

  7. Repository
    Repository

    (from [c9e176de78067c5941233b12686276d3016fbb38]) Fix: counter_cache should decrement on deleting associated records.

    [#1195 framework crashes on launch 'iconv': invalid encoding ("ascii//translit//IGNO... state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...

    December 10th, 2008 @ 07:05 PM

  8. Repository
    Repository

    (from [05f2183747c8e75c9e8bbaadb9573b4bdf41ecfc]) Fix: counter_cache should decrement on deleting associated records.

    [#1195 framework crashes on launch 'iconv': invalid encoding ("ascii//translit//IGNO... state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...

    December 10th, 2008 @ 07:05 PM

  9. explorer-lighthouse-skandragon (at flame)
    explorer-lighthouse-skandragon (at flame)
    • Tag changed from 2.2, bug, encoding, iconv, inflector to 2.2.2, bug, encoding, iconv, inflector

    I believe this fix is not complete. On NetBSD, I get this:

    irb(main):003:0> Iconv.iconv('ascii//ignore//translit', 'utf-8', 'test') Iconv::InvalidEncoding: invalid encoding ("ascii//ignore//translit", "utf-8")

        from (irb):3:in `iconv'
        from (irb):3
        from :0
    
    

    This is using the built-in libc version of the iconv library, built on a fairly recent NetBSD source tarball.

    February 3rd, 2009 @ 03:25 PM

  10. Michael Koziarski
    Michael Koziarski
    • State changed from committed to open

    That changeset has nothing to do with this ticket

    February 6th, 2009 @ 12:28 AM

  11. Repository
    Repository
    • State changed from open to committed

    (from [3c006d428b3d3d306185f620cce3821b1bdb636f]) Handle every error that can come out of the Iconv branch by rescuing and returning nil

    [#1195 framework crashes on launch 'iconv': invalid encoding ("ascii//translit//IGNO... state:committed]

    Conflicts:

    activesupport/lib/active_support/inflector.rb
    
    

    http://github.com/rails/rails/co...

    February 6th, 2009 @ 12:48 AM

  12. Repository
    Repository

    (from [4e4f961c112f1ffac73a1397d94dfbb4a10effae]) Handle every error that can come out of the Iconv branch by rescuing and returning nil

    [#1195 framework crashes on launch 'iconv': invalid encoding ("ascii//translit//IGNO... state:committed] http://github.com/rails/rails/co...

    February 6th, 2009 @ 12:48 AM

  13. David Reese
    David Reese

    Commit 3c006d428b3d3d306185f620cce3821b1bdb636f (rails 2.2), rails errors out -- the line should be if, not elseif.

    February 6th, 2009 @ 04:12 AM