diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 6c1f89d67..f32d8f090 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -65,9 +65,9 @@ Zotero_File_Exporter.prototype.save = function() { fp.appendFilters(Components.interfaces.nsIFilePicker.filterAll); } else { // if the result will be a file, append an extension and use filters - fp.defaultString = this.name+"."+io.selectedTranslator.target; + fp.defaultString = this.name+(io.selectedTranslator.target ? "."+io.selectedTranslator.target : ""); fp.defaultExtension = io.selectedTranslator.target; - fp.appendFilter(io.selectedTranslator.label, "*."+io.selectedTranslator.target); + fp.appendFilter(io.selectedTranslator.label, "*."+(io.selectedTranslator.target ? io.selectedTranslator.target : "*")); } var rv = fp.show(); diff --git a/chrome/content/zotero/xpcom/translation/browser_firefox.js b/chrome/content/zotero/xpcom/translation/browser_firefox.js index 447aa2388..aad4ca880 100644 --- a/chrome/content/zotero/xpcom/translation/browser_firefox.js +++ b/chrome/content/zotero/xpcom/translation/browser_firefox.js @@ -84,6 +84,7 @@ Zotero.Translate.SandboxManager.prototype = { return object[localKey].apply(object, args); }; + attachTo[localKey].name = localKey; // attach members if(!(object instanceof Components.interfaces.nsISupports)) { @@ -347,7 +348,7 @@ Zotero.Translate.IO.Write = function(file, mode, charset) { .createInstance(Components.interfaces.nsIFileOutputStream); this._rawStream.init(file, 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate this._writtenToStream = false; - if(mode) this.reset(mode, charset); + if(mode || charset) this.reset(mode, charset); } Zotero.Translate.IO.Write.prototype = { @@ -372,6 +373,8 @@ Zotero.Translate.IO.Write.prototype = { }, "write":function(data) { + if(!this._charset) this.setCharacterSet("UTF-8"); + if(!this._writtenToStream && this._charset.substr(this._charset.length-4) == "xBOM" && BOMs[this._charset.substr(0, this._charset.length-4).toUpperCase()]) { // If stream has not yet been written to, and a UTF type has been selected, write BOM