heyyas,
i know it's ugly, i know it's not been cleaned yet (i ripped it straight out of my framework, that's the main reason why it's ugly).
If there's interest in it i can also clean it up and make it look a bit shiny and tidy . Well, here's it:
http://nopaste.ghostdub.de/?306
(includes a sql table with the data for translating 4G proprietary charset nicknames to the new unicode/ucs2/utf16-le(?) system)