Forum: Ruby Pure ruby iconv?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Aee77dba395ece0a04c688b05b07cd63?d=identicon&s=25 Daniel Berger (djberg96)
on 2009-03-06 17:02
(Received via mailing list)
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
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2009-03-06 17:14
(Received via mailing list)
On Mar 6, 2009, at 9:59 AM, Daniel Berger 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 Gray II
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-03-06 18:05
(Received via mailing list)
James Gray wrote:
> On Mar 6, 2009, at 9:59 AM, Daniel Berger 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 :)

- Charlie
Aee77dba395ece0a04c688b05b07cd63?d=identicon&s=25 Daniel Berger (djberg96)
on 2009-03-06 18:53
(Received via mailing list)
On Mar 6, 10:03 am, Charles Oliver Nutter <charles.nut...@sun.com>
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 :)

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:

http://search.cpan.org/~jhi/perl-5.8.1/ext/Encode/bin/piconv

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
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2009-03-07 01:12
Daniel Berger 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 :)
http://github.com/oneclick/rubyinstaller/tree/master

Good luck!
-=r
This topic is locked and can not be replied to.