# Converting from iso-8559-1 to utf-8

**URL:** <https://www.ruby-forum.com/t/converting-from-iso-8559-1-to-utf-8/128017>\
**Category:** Ruby\
**Created:** [February 4, 2008, 9:57am UTC](https://www.ruby-forum.com/t/converting-from-iso-8559-1-to-utf-8/128017 "2008-02-04T09:57:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikel\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/2bfe46/32.png) [@Mikel\_L](https://www.ruby-forum.com/u/Mikel_L)\
**Post date:** [February 4, 2008, 9:57am UTC](https://www.ruby-forum.com/t/converting-from-iso-8559-1-to-utf-8/128017/1 "2008-02-04T09:57:34Z")

</div>

Hey all,

I am rendering onto a web page a file that has a iso-8559-1 character  
set, Rails sends out data as UTF-8, so i am getting character mapping  
errors.

I thought the most straightforward solution would be to convert the  
input file text into UTF-8 first, then pass it over to rails to fire  
out as UTF-8.

I thought I could do (summary code):

trans = Iconv.new(‘UTF-8’, ‘ISO-8559-1’)  
input\_text = File.read(‘filename’)  
output\_text = trans.iconv(input\_text)

But I get an unsupported encoding error on my Mac and Windows.

How do y’all convert this iso-8559-1 charset?

Regards

Mikel

---

<div class="post-metadata">

**Author:** ![Mikel\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/2bfe46/32.png) [@Mikel\_L](https://www.ruby-forum.com/u/Mikel_L)\
**Post date:** [February 4, 2008, 4:21pm UTC](https://www.ruby-forum.com/t/converting-from-iso-8559-1-to-utf-8/128017/2 "2008-02-04T16:21:09Z")

</div>

On Feb 4, 2008 7:56 PM, Mikel L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How do y’all convert this iso-8559-1 charset?

Never mind… the way you do it is SPELL THE CHARACTER ENCODING  
CORRECTLY.

It is 8859, not 8559.

Hurumpf 🙂

Mikel
