diff --git a/frappe/utils/__init__.py b/frappe/utils/__init__.py index da3c34307b..cd33f7ecf8 100644 --- a/frappe/utils/__init__.py +++ b/frappe/utils/__init__.py @@ -127,7 +127,12 @@ def has_gravatar(email): # since querying gravatar for every item will be slow return '' - gravatar_url = "https://secure.gravatar.com/avatar/{hash}?d=404&s=200".format(hash=md5.md5(email).hexdigest()) + if not isinstance(email, unicode): + email = unicode(email, 'utf-8') + + hexdigest = md5.md5(email).hexdigest() + + gravatar_url = "https://secure.gravatar.com/avatar/{hash}?d=404&s=200".format(hash=hexdigest) try: res = requests.get(gravatar_url) if res.status_code==200: