This commit is contained in:
Kovid Goyal 2019-04-10 18:37:41 +05:30
commit 15e075f2d7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 2 deletions

View File

@ -51,7 +51,10 @@ all_author_searches = AUTHOR_SEARCHES.__iter__
def qquote(val):
if not isinstance(val, bytes):
val = val.encode('utf-8')
return quote_plus(val).decode('utf-8')
ans = quote_plus(val)
if isinstance(ans, bytes):
ans = ans.decode('utf-8')
return ans
def url_for(template, data):

View File

@ -74,7 +74,10 @@ def query(br, url, key, dump_raw=None, limit=1, parser=parse_html, timeout=60):
def quote_term(x):
return quote_plus(x.encode('utf-8')).decode('utf-8')
ans = quote_plus(x.encode('utf-8'))
if isinstance(ans, bytes):
ans = ans.decode('utf-8')
return ans
# DDG + Wayback machine {{{