--nextPart1229927.MlQh84HX6u Content-Type: text/plain; charset tf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline quoth the Chris Hulan: > darren kirby wrote: > > Hello all. > > > > I am unpacking some unicode strings from a binary file. I have a string > > like: > > > > "W\000M\000/\000T\000r\000a\000c\000k\000N\000u\000m\000b\000e\000r\000\0 > >00\000\003" > > > > and I need to turn it into: > > > > "WM/TrackNumber" > > could try: > > myAscii = s.unpack('U'*s.length).select{|x| x >46}.collect{|x| > x.chr}.to_s Hello, This is fairly close to something I was trying earlier, except more elegant. This seems to be munging my spaces though, as I take it the space code is less than 46? Have to look for a chart. Is unpacking as UTF8 going to be problematic if the string is actually UTF16 as Philip points out? I will play some more, thanks guys... -d -- darren kirby :: Part of the problem since 1976 :: http://badcomputer.org "...the number of UNIX installations has grown to 10, with more expected..." - Dennis Ritchie and Ken Thompson, June 1972 --nextPart1229927.MlQh84HX6u Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) iD8DBQBEmww6wPD5Cr/3CJgRAmICAJ0XGwObKIjRF3ybfPxENqqCHSnonQCcDVe7 jnVhFaJkX1AO9EsxQ5rTV3w Sq -----END PGP SIGNATURE----- --nextPart1229927.MlQh84HX6u--