# Iconv::InvalidEncoding (""ISO-8859-1"", "UTF-8")

**URL:** <https://www.ruby-forum.com/t/iconv-invalidencoding-iso-8859-1-utf-8/169712>\
**Category:** Rails\
**Created:** [June 7, 2009, 4:17pm UTC](https://www.ruby-forum.com/t/iconv-invalidencoding-iso-8859-1-utf-8/169712 "2009-06-07T16:17:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ariel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ccd318/32.png) [@ariel](https://www.ruby-forum.com/u/ariel)\
**Post date:** [June 7, 2009, 4:17pm UTC](https://www.ruby-forum.com/t/iconv-invalidencoding-iso-8859-1-utf-8/169712/1 "2009-06-07T16:17:20Z")

</div>

Hi,

I’m having the error: Iconv::InvalidEncoding: invalid encoding  
("“ISO-8859-1"”, “UTF-8”) when trying to post via Mechanize.

It used to work just fine, but the error appeared after (I think)  
upgrading to Rails 2.3.2, Ruby 1.8.7, Mechanize 0.9.2 (I upgraded a  
while ago and only now noticed the problem).

What does it mean? Is there any way to disable/bypass the error?  
Any help would be much appreciated!

Thanks a lot,  
Ariel

---

<div class="post-metadata">

**Author:** ![ariel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ccd318/32.png) [@ariel](https://www.ruby-forum.com/u/ariel)\
**Post date:** [June 8, 2009, 6:25pm UTC](https://www.ruby-forum.com/t/iconv-invalidencoding-iso-8859-1-utf-8/169712/2 "2009-06-08T18:25:54Z")

</div>

Quoting Ariel S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> What does it mean? Is there any way to disable/bypass the error?  
> Any help would be much appreciated!

Two things, try without the double quotes in the first argument (unless  
this  
is just a transcription error), and have you checked that there is no  
invalid  
codes in the input, i.e. that the input is truely ASCII or Latin-1? I  
have  
similar errors but every time I’ve looked, it is because the source has  
garble  
in it. Latin-1 but they claim it is UTF-8 (these are RSS feeds), or no  
encoding info at all (perhaps some Windows encoding).

I have not figured out how to get Iconv to recover from errors; if you  
do,  
please post the solution here.

Jeffrey
