Hi

Is it possible to use Character encoding converters from Firefox
extension (javascript)  ?
I want to encode strings from UTF-8 to national encodings
(windows-1251). I tried to use:

var charsetManager = Components.classes["@mozilla.org/charset-
converter-manager;1"]
                                
.getService(Components.interfaces.nsICharsetConverterManager);
var encoder = charsetManager.getUnicodeEncoder("windows-1251");

but I get an error: "Cannot find interface information for parameter"
nsresult: "0x80570006 (NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO)"

I also tried to do:

var encoder = Components.classes["@mozilla.org/intl/unicode/encoder;1?
charset=windows-1251"]
                    .getService(Components.interfaces.nsIUnicodeEncoder);

but also get an error: "Invalid InterfaceID" nsresult: "0x80570018
(NS_ERROR_XPC_BAD_IID)"

Thanks,
telega

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to