def export_bibliography(collection, destination, fix_bib=False, *args, **kwargs): bib_string = Zotero().export_bibliography(collection, *args, **kwargs) if fix_bib: bib_string = fix_bibliography(bib_string) bib_unicode = bib_string.decode('UTF-8') with codecs.open(destination, encoding='UTF-8', mode='w') as output_file: output_file.write(bib_unicode)
def fix_bibliography_wrapper(source, destination): with codecs.open(source, encoding="UTF-8") as bibtex_file: result = fix_bibliography(bibtex_file.read()) with codecs.open(destination, encoding='UTF-8', mode='w') as output_file: output_file.write(result)