Converting from iso-8559-1 to utf-8

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

On Feb 4, 2008 7:56 PM, Mikel L. [email protected] 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 :slight_smile:

Mikel

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs