# Problem with Iconv

**URL:** <https://www.ruby-forum.com/t/problem-with-iconv/115439>\
**Category:** Ruby\
**Created:** [September 25, 2007, 9:54am UTC](https://www.ruby-forum.com/t/problem-with-iconv/115439 "2007-09-25T09:54:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![silvertab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@silvertab](https://www.ruby-forum.com/u/silvertab)\
**Post date:** [September 25, 2007, 9:54am UTC](https://www.ruby-forum.com/t/problem-with-iconv/115439/1 "2007-09-25T09:54:32Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![silvertab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@silvertab](https://www.ruby-forum.com/u/silvertab)\
**Post date:** [September 25, 2007, 1:31pm UTC](https://www.ruby-forum.com/t/problem-with-iconv/115439/2 "2007-09-25T13:31:06Z")

</div>

On 9/25/07, Jean-nicolas Jolivet [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

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

---

<div class="post-metadata">

**Author:** ![silvertab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@silvertab](https://www.ruby-forum.com/u/silvertab)\
**Post date:** [September 25, 2007, 4:16pm UTC](https://www.ruby-forum.com/t/problem-with-iconv/115439/3 "2007-09-25T16:16:44Z")

</div>

Luis P. wrote:

> On 9/25/07, Jean-nicolas Jolivet [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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…

---

<div class="post-metadata">

**Author:** ![silvertab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/22d042/32.png) [@silvertab](https://www.ruby-forum.com/u/silvertab)\
**Post date:** [September 25, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/problem-with-iconv/115439/4 "2007-09-25T20:35:49Z")

</div>

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 … ☹
