From: Paul Battley Date: 2006-08-01T17:36:31+09:00 Subject: Re: UCS-2 On 01/08/06, dave.burt@gmail.com wrote: > Florian Weber wrote: > > Hi! > > > > Is there any way to decode a UCS-2 string with ruby? > > irb> require 'iconv' > => true > irb> Iconv.iconv("UTF-8", "UCS-2", "\0a\0b") > => ["ab"] It's probably worth specifying endianness for portability: Iconv.iconv("UTF-8", "UCS-2BE", "\0a\0b") However, are you sure you want UCS-2, and not its superset UTF-16? In my experience, specifying UCS-2 instead of UTF-16 is almost always a bug. Paul.