www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit d821778d247d00de1d08c949ec5ac7d9e0438e3b
parent 53449d47a993f615000490938ccbd1fa24ad6715
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 19 Sep 2012 02:37:18 -0400

Use ASCII for translator filenames

Remove diacritics and then use translatorID for anything that still has
extended characters.

Fixes #459, Non-ascii translator names

Diffstat:
Mchrome/content/zotero/xpcom/schema.js | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js @@ -692,7 +692,12 @@ Zotero.Schema = new function(){ } } - var fileName = Zotero.File.getValidFileName(entry.label) + fileExt; + var fileName = Zotero.Utilities.removeDiacritics( + Zotero.File.getValidFileName(entry.label)) + fileExt; + // Use translatorID if name still isn't ASCII (e.g., Cyrillic) + if (!fileName.match(/^[\x00-\x7f]+$/)) { + fileName = entry.translatorID + fileExt; + } var destFile = destDir.clone(); destFile.append(fileName); @@ -815,7 +820,12 @@ Zotero.Schema = new function(){ } if (mode == 'translator') { - var fileName = Zotero.File.getValidFileName(newObj[titleField]) + fileExt + var fileName = Zotero.Utilities.removeDiacritics( + Zotero.File.getValidFileName(newObj[titleField])) + fileExt; + // Use translatorID if name still isn't ASCII (e.g., Cyrillic) + if (!fileName.match(/^[\x00-\x7f]+$/)) { + fileName = newObj.translatorID + fileExt; + } } else if (mode == 'style') { var fileName = file.leafName;