Problem with Iconv

  • Thread starter Jean-nicolas Jolivet
  • Start date
J

Jean-nicolas Jolivet

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 :)
 
L

Luis Parravicini

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

Jean-nicolas Jolivet

Luis said:
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...
 
J

Jean-nicolas Jolivet

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 ... :(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top