I *think* the following code snippet will work, but its untested:
var text_unicode = "hello world";
var converter =
Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
.getService()
.QueryInterface(Components.interfaces.nsIScriptableUnicodeConverter);
converter.charset = "Big5-HKSCS";
var text_big5 = converter.ConvertFromUnicode(text_unicode);
I've added a bug report so an easy way to handle character set
conversions should make it into Ubiquity sometime:
http://labs.toolness.com/trac/ticket/258
If you could (and anyone else) report back to this discussion thread to
let me know if that code worked, and what type of APIs would be helpful.
- Blair