[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Pure ruby iconv?

Daniel Berger

3/6/2009 4:00:00 PM

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

4 Answers

James Gray

3/6/2009 4:12:00 PM

0

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

Charles Oliver Nutter

3/6/2009 5:03:00 PM

0

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

Daniel Berger

3/6/2009 5:51:00 PM

0



On Mar 6, 10:03=A0am, Charles Oliver Nutter <charles.nut...@sun.com>
wrote:
> 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. =A0This 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 :)

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/...

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

Roger Pack

3/7/2009 12:11:00 AM

0

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/t...

Good luck!
-=r
--
Posted via http://www.ruby-....