Fix open/save window importing BibTeX files without UTF-8 BOM in auto mode -- just default to UTF-8
This commit is contained in:
parent
31943dfba7
commit
3b9f23baf3
3 changed files with 11 additions and 7 deletions
|
@ -245,12 +245,14 @@ Zotero.File = new function(){
|
|||
*/
|
||||
function getCharsetFromFile(file, mimeType, callback, args){
|
||||
if (!file || !file.exists()){
|
||||
return false;
|
||||
callback(false, args);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mimeType.substr(0, 5)!='text/' ||
|
||||
!Zotero.MIME.hasInternalHandler(mimeType, this.getExtension(file))){
|
||||
return false;
|
||||
if (mimeType.substr(0, 5) != 'text/' ||
|
||||
!Zotero.MIME.hasInternalHandler(mimeType, this.getExtension(file))) {
|
||||
callback(false, args);
|
||||
return;
|
||||
}
|
||||
|
||||
var browser = Zotero.Browser.createHiddenBrowser();
|
||||
|
|
|
@ -79,7 +79,8 @@ Zotero.MIME = new function(){
|
|||
var _externalTextExtensions = {
|
||||
graffle: true,
|
||||
mm: true,
|
||||
opml: true
|
||||
opml: true,
|
||||
bib: true
|
||||
};
|
||||
|
||||
|
||||
|
@ -324,7 +325,7 @@ Zotero.MIME = new function(){
|
|||
function hasNativeHandler(mimeType, ext) {
|
||||
if (mimeType.match(/^text\//)) {
|
||||
if (isExternalTextExtension(ext)){
|
||||
Zotero.debug('text file has extension that should be handled externally');
|
||||
Zotero.debug(mimeType + " file has extension '" + ext + "' that should be handled externally");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1799,7 +1799,8 @@ Zotero.Translate.prototype._importSniffCharacterSet = function(callback) {
|
|||
var me = this;
|
||||
Zotero.File.getCharsetFromFile(this.location, "text/plain",
|
||||
function(charset) {
|
||||
me._charset = charset;
|
||||
// Default to UTF-8 if no charset available
|
||||
me._charset = charset ? charset : "UTF-8";
|
||||
me._importDoneSniffing(charset);
|
||||
});
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue