Skip to content

Commit 82c1a42

Browse files
committed
first step toward fixing issue #36.
I'm not too happy about it though.
1 parent 92d1157 commit 82c1a42

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

tests/test_github_issues.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,9 @@ def test_github_issue_30():
8585
result = textile.textile(text)
8686
expect = '\t<p><a href="http://lala.com" title="Tëxtíle">Tëxtíle</a></p>'
8787
assert result == expect
88+
89+
def test_github_issue_36():
90+
text = '"Chögyam Trungpa":https://www.google.com/search?q=Chögyam+Trungpa'
91+
result = textile.textile(text)
92+
expect = '\t<p><a href="https://www.google.com/search?q=Ch%C3%B6gyam%2BTrungpa">Chögyam Trungpa</a></p>'
93+
assert result == expect

textile/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,10 @@ def encode_url(self, url):
938938
quote(unquote(pce).encode('utf8'), b'')
939939
for pce in parsed.path.split('/')
940940
)
941-
query = quote(unquote(parsed.query), b'=&?/')
941+
query_text = parsed.query
942+
if isinstance(query_text, six.text_type):
943+
query_text = query_text.encode('utf-8')
944+
query = quote(unquote(query_text), b'=&?/')
942945
fragment = quote(unquote(parsed.fragment))
943946

944947
# put it back together

0 commit comments

Comments
 (0)