--nextPart2730957.KaNmrRNY05
Content-Type: text/plain;
  charsettf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

quoth the Paul Battley:

> > So can I extract an ascii representation of this string? I will admit I
> > don't know the first thing about unicode and I may be totally lost
> > here...
>
> Here's a reliable way to do it with Iconv:
>
> require 'iconv'
> s =
> "W\000M\000/\000T\000r\000a\000c\000k\000N\000u\000m\000b\000e\000r\000\000
>\000\003" ic = Iconv.new("US-ASCII//IGNORE", "UTF-16LE")
> p (ic.iconv(s+' '))[0..-2] # => "WM/TrackNumber"

Hi Paul,

This seems to be working quite nicely, after playing around for a bit. A few 
of my test files were throwing "Iconv::InvalidCharacter" errors on some 
strings, but when I change the "(s+' ')" to "(s)" it works fine. Then, of 
course, the strings that originally worked start throwing the error. So, I do 
this:

begin
  textString = @ic.iconv(data+' ')[0..-2]
rescue
  textString = @ic.iconv(data)[0..-2]
end

Yesir, I am really just mashing code together until I see the results I am 
looking for...

I wonder though, the docs lead me to believe the iconv library is UNIX only. 
Is this true? I really need a cross-platform solution, but don't have a win32 
box to try on...

Thanks very much,

> Paul.

-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

--nextPart2730957.KaNmrRNY05
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQBEm/k9wPD5Cr/3CJgRAtmzAKDJoUTzyWW50X7nwFEx++7hMV2bagCeIlXw
b5ktNMGgfC0eBNpGUVeYk8UlZZ
-----END PGP SIGNATURE-----

--nextPart2730957.KaNmrRNY05--