charset is a complex value in newer Fx versions

probably fixes http://forums.zotero.org/discussion/21956/zotero-wont-accept-ris-file/#Item_2
This commit is contained in:
Simon Kornblith 2012-02-16 03:50:26 -05:00
parent bfa7b5b153
commit 6a68139591

View File

@ -332,10 +332,22 @@ Zotero.Translate.IO.Read = function(file, mode) {
// if the regexp continues to fail, this is not UTF-8
if(!isUTF8) {
// Can't be UTF-8; see if a default charset is defined
this._charset = Zotero.Prefs.get("intl.charset.default", true);
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
try {
this._charset = prefs.getComplexValue("intl.charset.default",
Components.interfaces.nsIPrefLocalizedString).toString();
} catch(e) {}
// ISO-8859-1 by default
if(!this._charset) this._charset = "ISO-8859-1";
if(!this._charset) {
try {
this._charset = prefs.getCharPref("intl.charset.default");
} catch(e) {}
// ISO-8859-1 by default
if(!this._charset) this._charset = "ISO-8859-1";
}
break;
}