From: ser@... (Sean Russell) Date: 2004-05-03T21:24:00+09:00 Subject: Re: how can I add the iconv extension to Ruby? "Martin Elzen" wrote in message news:... > I want to be able to convert UTF-16 strings to UTF-8. From a usenet post I > understand that the standard 'iconv' ext for Ruby can do that. That same > post explained that you have to: This won't solve your iconv problems, but if all you want to do is convert UTF-16 to UTF-8, a quick and dirty solution is: def u16_to_u8(str) array_enc=str.unpack('C*') array_utf8 = [] 2.step(array_enc.size-1, 2){|i| array_utf8 << (array_enc.at(i+1) + array_enc.at(i)*0x100) } array_utf8.pack('U*') end --- SER