how do I change encoding from/to utf-8 to/from cp949

86 views
Skip to first unread message

shurain

unread,
Sep 3, 2008, 11:04:57 AM9/3/08
to ubiquity-firefox
There are some web servers that'll only take certain encoding for
their input parameters. I know that javascript does not support
encodings very well but is there some kind of encoding support from
ubiquity?

Maurice

unread,
Sep 4, 2008, 7:47:48 AM9/4/08
to ubiquity-firefox
I'm facing the same problem here with utf-8 -> big5.
It would be great if there is support from ubiquity.

Might not need to be an actual convert function but an option to send
the current selection to a converter first, before sending it to the
command?
or stacked-command? something like search(convert(this))?

Blair McBride

unread,
Sep 6, 2008, 8:30:35 AM9/6/08
to ubiquity...@googlegroups.com
There isn't any specific functionality in Ubiquity to handle this. But I
do think its something that should be added to Ubiquity.

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

Maurice

unread,
Sep 13, 2008, 10:45:33 AM9/13/08
to ubiquity-firefox
It's working like a charm!

thx!
Reply all
Reply to author
Forward
0 new messages