From: nobu.nokada@... Date: 2004-05-12T18:59:52+09:00 Subject: Re: how can I add the iconv extension to Ruby? Hi, At Mon, 3 May 2004 21:24:00 +0900, Sean Russell wrote in [ruby-talk:99088]: > 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 Wasn't this posted already? def u16_to_u8(str) str.unpack('n*').pack('U*') end -- Nobu Nakada