Fx-compat: nsIUTF8ConverterServicensIScriptableUnicodeConverter

It's not totally clear what this does or if it's necessary (see #1540),
but this is a replacement that Thunderbird used.
This commit is contained in:
Dan Stillman 2020-07-05 18:07:04 -04:00
parent bbecb4d0bd
commit 6d5b2c3d12

View file

@ -67,8 +67,8 @@ Zotero.Fulltext = Zotero.FullText = new function(){
yield Zotero.DB.queryAsync("ATTACH ':memory:' AS 'indexing'"); yield Zotero.DB.queryAsync("ATTACH ':memory:' AS 'indexing'");
yield Zotero.DB.queryAsync('CREATE TABLE indexing.fulltextWords (word NOT NULL)'); yield Zotero.DB.queryAsync('CREATE TABLE indexing.fulltextWords (word NOT NULL)');
this.decoder = Components.classes["@mozilla.org/intl/utf8converterservice;1"]. this.unicodeConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
getService(Components.interfaces.nsIUTF8ConverterService); .createInstance(Ci.nsIScriptableUnicodeConverter);
let pdfConverterFileName = "pdftotext"; let pdfConverterFileName = "pdftotext";
let pdfInfoFileName = "pdfinfo"; let pdfInfoFileName = "pdfinfo";
@ -1675,7 +1675,8 @@ Zotero.Fulltext = Zotero.FullText = new function(){
try { try {
if (charset && charset != 'utf-8') { if (charset && charset != 'utf-8') {
text = this.decoder.convertStringToUTF8(text, charset, true); this.converter.charset = charset;
text = this.converter.ConvertToUnicode(text);
} }
} catch (err) { } catch (err) {
Zotero.debug("Error converting from charset " + charset, 1); Zotero.debug("Error converting from charset " + charset, 1);