Skip to content

Commit

Permalink
Fix keyword search parameter encoding.
Browse files Browse the repository at this point in the history
convertFromUnicode appears to have been removed in FF51; this is a
minimal fix.

Fixes #201.
  • Loading branch information
dkearns committed Feb 14, 2017
1 parent dbfb4eb commit f93718d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions common/content/bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,18 @@ var Bookmarks = Module("bookmarks", {
}
catch (e) {}

if (charset)
var encodedParam = escape(window.convertFromUnicode(charset, param)).replace(/\+/g, encodeURIComponent);
if (charset) {
try {
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = charset;
var encodedParam = converter.ConvertFromUnicode(param) + converter.Finish();
}
catch (e) {
encodedParam = param;
}
encodedParam = escape(encodedParam).replace(/\+/g, encodeURIComponent);
}
else
encodedParam = bookmarkcache.keywords[keyword.toLowerCase()].encodeURIComponent(param);

Expand Down

0 comments on commit f93718d

Please sign in to comment.