diff --git a/tests/test_github_issues.py b/tests/test_github_issues.py index 20448c7f..6481bcd9 100644 --- a/tests/test_github_issues.py +++ b/tests/test_github_issues.py @@ -85,3 +85,9 @@ def test_github_issue_30(): result = textile.textile(text) expect = '\t
' assert result == expect + +def test_github_issue_36(): + text = '"Chögyam Trungpa":https://www.google.com/search?q=Chögyam+Trungpa' + result = textile.textile(text) + expect = '\t' + assert result == expect diff --git a/textile/core.py b/textile/core.py index b9627510..30d5a020 100644 --- a/textile/core.py +++ b/textile/core.py @@ -938,7 +938,10 @@ def encode_url(self, url): quote(unquote(pce).encode('utf8'), b'') for pce in parsed.path.split('/') ) - query = quote(unquote(parsed.query), b'=&?/') + query_text = parsed.query + if isinstance(query_text, six.text_type): + query_text = query_text.encode('utf-8') + query = quote(unquote(query_text), b'=&?/') fragment = quote(unquote(parsed.fragment)) # put it back together