[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Problem with Iconv

Jean-nicolas Jolivet

9/25/2007 7:55:00 AM

I have a weird problem with Iconv... I'm trying to use it to generate a
permalink (so it removes all accentuated characters like french accents
etc..)..

It was working well when I was running RoR on cygwin... Now with Instant
Rails I get the following error:

Iconv::IllegalSequence in ItemController#new


The exact same method was working flawlessly on cygwin... now it chokes
at the first accentuated character...

Anyone has an idea ? (Please don't tell me to go back to cygwin, it was
really slow LOL)

thanks :)
--
Posted via http://www.ruby-....

3 Answers

Luis Parravicini

9/25/2007 11:30:00 AM

0

On 9/25/07, Jean-nicolas Jolivet <phpcode@gmail.com> wrote:
> It was working well when I was running RoR on cygwin... Now with Instant
> Rails I get the following error:
>
> Iconv::IllegalSequence in ItemController#new
>
>
> The exact same method was working flawlessly on cygwin... now it chokes
> at the first accentuated character...
>
> Anyone has an idea ? (Please don't tell me to go back to cygwin, it was
> really slow LOL)

Is this error happening with the same strings used as arguments?.
Maybe under cygwin you are using certain encoding and now the strings
you are using are in a different encoding.

--
Luis Parravicini
http://ktulu.co...

Jean-nicolas Jolivet

9/25/2007 2:17:00 PM

0

Luis Parravicini wrote:
> On 9/25/07, Jean-nicolas Jolivet <phpcode@gmail.com> wrote:
> Is this error happening with the same strings used as arguments?.
> Maybe under cygwin you are using certain encoding and now the strings
> you are using are in a different encoding.


Yes, it is the exact same string I'm using as argument!

Any way I could find out about the encoding?

Basically I'm trying to produce a permalink for an article name
(submitted via a webform)... and add it to the db..it works with strings
that don't have any special characters....but as soon as I add a French
or Spanish accent in my string... I get the error...

And I'm 100% sure the same code (I copy/pasted it) was working under
cygwin...
--
Posted via http://www.ruby-....

Jean-nicolas Jolivet

9/25/2007 6:36:00 PM

0

One "small" update...

if I use

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

(i.e. adding ignore)... it will work, but the accentuated characters are
only removed... (and not converted to their utf-8 equivalent)...

using the following will also work:

Iconv.new('ISO-8859-1', 'utf-8').iconv

But I get weird results (some characters are removed, some are
converted..)

What I'm really wondering is, why 'ascii/translit' was working just
fine on cygwin and gives me an error on InstantRails ... :(
--
Posted via http://www.ruby-....