On Mon, Jun 05, 2006 at 09:06:00AM +0000, Stefan Huelswitt wrote:
Hi,
I have a question regarding handling of ID3 tags which are non-latin1 encoded e.g. iso-8859-5.
I think I can get ucs4 strings from libid3tag and convert them with iconv to whatever codeset originaly was used.
What you really should do is convert things to wchar_t, and then use functions that work with them (like wprintf()) to output things. This should be much more portable.
I find it unfortute libid3tag does everything with ucs4 instead of wchar_t's.
Anyway, one problem you should probably be aware of is that id3_ucs4_t is a long, which is typicaly 64 bit on a 64 bit machine, and so is not 4 bytes as you might expect.
I'm not sure what's the best way to convert it from ucs4 to wchar_t though, and can't think of a portable way, and I'd love if someone could point me out how to do it.
(On Linux (glibc), casting it from a id3_ucs4_t to a wchar_t seems to work, but it's not portable.)
Kurt