From: Paul Battley Date: 2005-12-27T18:19:03+09:00 Subject: Re: Mac OS Roma to UTF-8 (Kconv | Iconv] > Because i'll use the output in an xml form i need to translate to UTF-8. Not necessarily. Just make sure that the encoding is specified in your XML prolog: > also if i make use of Iconv.new('MACROMAN', 'UTF-8').iconv(str) > > i get an error message : > AddressBook2vCardXml.rb:32:in `iconv': "\216" (Iconv::IllegalSequence) > > for the first accentuated string (the "�" of Ren�). That's because the parameters are in the wrong order. They should be given as (to, from). Your example is therefore trying to convert *from* UTF-8 *to* Mac Roman, which is why the � is illegal. Try this instead: utf8_str = Iconv.new('UTF-8', 'MacRoman').iconv(mac_str) e.g. $KCODE = 'u' require 'iconv' Iconv.new('UTF-8', 'MacRoman').iconv("Ren\216") # => "Ren�" [in UTF-8] Paul.