Problem with the swedish character "å" when importing from Mendeley

So I am trying to import my Mendeley-library to Zotero. I selected my full library and exported as bib, and imported it to Zotero (the auto-import did not work for some reason).

It worked great except that the Swedish letter "å" gets imported as "\aa". Umlaut-characters "ä" and "ö" was imported flawlessly.

I tried to run Javascript as described here: https://www.zotero.org/support/dev/client_coding/javascript_api#batch_editing

But return value was "no items found".

My edited code was as such:
---------
var fieldName = "publicationTitle";
var oldValue = "\aa";
var newValue = "å";

var fieldID = Zotero.ItemFields.getID(fieldName);
var s = new Zotero.Search();
s.libraryID = Zotero.Libraries.userLibraryID;
s.addCondition(fieldName, 'is', oldValue);
var ids = await s.search();
if (!ids.length) {
return "No items found";
}
await Zotero.DB.executeTransaction(async function () {
for (let id of ids) {
let item = await Zotero.Items.getAsync(id);
let mappedFieldID = Zotero.ItemFields.getFieldIDFromTypeAndBase(item.itemTypeID, fieldName);
item.setField(mappedFieldID ? mappedFieldID : fieldID, newValue);
await item.save();
}
});
return ids.length + " item(s) updated";
----------

Did I miss something?

Is there any other way to fix it without resorting to manually editing the entries? I have hundreds of titles and authors with "å" in them, so if it doesn't work I need to change back to Mendeley, and we don't want that do we? :)

Thanks /Daniel
Sign In or Register to comment.