Pure ruby iconv?

Hi,

It looks like Rails 2.x requires the iconv library. Unfortunately,
libiconv requires mingw or cygwin to build properly. Since I have
neither, I’m in a bit of a bind.

I thought there was a pure Ruby library (or three) out there that
could do what iconv does, but I’ve never done the research.

Specifically, it looks like ActiveSupport requires it:

activesupport-2.2.2\lib\active_support\inflector.rb

Replaces accented characters with their ascii equivalents.

def transliterate(string)
Iconv.iconv(‘ascii//ignore//translit’, ‘utf-8’, string).to_s
end

Any suggestions? Or do I need to put a bounty out there for a pure
ruby iconv now?

Regards,

Dan

PS - A comment in the code also suggests that method doesn’t function
properly

On Mar 6, 2009, at 9:59 AM, Daniel B. wrote:

Any suggestions? Or do I need to put a bounty out there for a pure
ruby iconv now?

I sure hope you’re planning to offer considerable more than $100 for
that effort. This is no Zlib!

James Edward G. II

James G. wrote:

On Mar 6, 2009, at 9:59 AM, Daniel B. wrote:

Any suggestions? Or do I need to put a bounty out there for a pure
ruby iconv now?

I sure hope you’re planning to offer considerable more than $100 for
that effort. This is no Zlib!

That’s for sure…Iconv is a brute. I’d love to see a pure Ruby version
(and in this case we’d probably use it in JRuby as well), but it would
mean a substantial amount of effort.

Not that I’m trying to scare anyone interested in doing it, of course :slight_smile:

  • Charlie

On Mar 6, 10:03 am, Charles Oliver N. [email protected]
wrote:

(and in this case we’d probably use it in JRuby as well), but it would
mean a substantial amount of effort.

Not that I’m trying to scare anyone interested in doing it, of course :slight_smile:

Oh, sure, I could offer more money. But first I want to make sure
there isn’t an alternative already out there.

BTW, it looks like Perl did it already with piconv, though I’m not
sure how much of it depends on features within Perl itself:

If there isn’t a working alternative I’ll probably handle this one
differently, i.e. I’d setup a separate rubyforge project for it in
advance, allow multiple developers (probably up to 3), hand pick the
developers if there are too many volunteers, set some milestones and
pay in increments.

However, it may not be necessary in the short term. I discovered,
thanks to my Solaris box, that the way Rails is handling the
redefinition of the transliterate method in inflector.rb is broken.
It’s only checking the return value of Iconv.iconv, but not whether or
not an error is raised.

Time to file a bug report and patch.

Regards,

Dan

Daniel B. wrote:

Hi,

It looks like Rails 2.x requires the iconv library. Unfortunately,
libiconv requires mingw or cygwin to build properly. Since I have
neither, I’m in a bit of a bind.

I thought there was a pure Ruby library (or three) out there that
could do what iconv does, but I’ve never done the research.

Specifically, it looks like ActiveSupport requires it:

activesupport-2.2.2\lib\active_support\inflector.rb

Replaces accented characters with their ascii equivalents.

def transliterate(string)
Iconv.iconv(‘ascii//ignore//translit’, ‘utf-8’, string).to_s
end

Any suggestions? Or do I need to put a bounty out there for a pure
ruby iconv now?

You could download mingw :slight_smile:

Good luck!
-=r