Skip to content

Commit

Permalink
first step toward fixing issue #36.
Browse files Browse the repository at this point in the history
I'm not too happy about it though.
  • Loading branch information
ikirudennis committed Oct 26, 2016
1 parent 92d1157 commit 82c1a42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tests/test_github_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,9 @@ def test_github_issue_30():
result = textile.textile(text)
expect = '\t<p><a href="http://lala.com" title="Tëxtíle">Tëxtíle</a></p>'
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<p><a href="https://www.google.com/search?q=Ch%C3%B6gyam%2BTrungpa">Chögyam Trungpa</a></p>'
assert result == expect
5 changes: 4 additions & 1 deletion textile/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 82c1a42

Please sign in to comment.