From 0432591e88e237fafbc1f55493b0e03874a4997e Mon Sep 17 00:00:00 2001 From: Tharunoo3 Date: Thu, 30 Oct 2025 20:43:01 +0530 Subject: [PATCH] Fix Unicode errors for accented usernames --- sherlock_project/sherlock.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sherlock_project/sherlock.py b/sherlock_project/sherlock.py index f78d4b8ca..9047781eb 100644 --- a/sherlock_project/sherlock.py +++ b/sherlock_project/sherlock.py @@ -28,6 +28,7 @@ import requests from requests_futures.sessions import FuturesSession +from urllib.parse import quote from sherlock_project.__init__ import ( __longname__, @@ -136,6 +137,10 @@ def get_response(request_future, error_type, social_network): except requests.exceptions.RequestException as err: error_context = "Unknown Error" exception_text = str(err) + except UnicodeDecodeError as erru: + error_context = "Unicode Decode Error" + exception_text = str(erru) + return response, error_context, exception_text @@ -243,7 +248,8 @@ def sherlock( headers.update(net_info["headers"]) # URL of user on site (if it exists) - url = interpolate_string(net_info["url"], username.replace(' ', '%20')) + username_safe = quote(username) + url = interpolate_string(net_info["url"], username_safe) # Don't make request if username is invalid for the site regex_check = net_info.get("regexCheck")