diff --git a/pubs/apis.py b/pubs/apis.py index 8c95126..0a0e449 100644 --- a/pubs/apis.py +++ b/pubs/apis.py @@ -3,15 +3,19 @@ import requests from bs4 import BeautifulSoup + def doi2bibtex(doi): """Return a bibtex string of metadata from a DOI""" url = 'http://dx.doi.org/{}'.format(doi) headers = {'accept': 'application/x-bibtex'} r = requests.get(url, headers=headers) + if r.encoding is None: + r.encoding = 'utf8' # Do not rely on guessing from request return r.text + def isbn2bibtex(isbn): """Return a bibtex string of metadata from a DOI"""