Skip to content

Commit 00ec365

Browse files
committed
fix #45
1 parent 788895c commit 00ec365

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

tests/test_github_issues.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,10 @@ def test_github_issue_43():
130130
result = textile.textile(text)
131131
expect = '<pre>smart ‘quotes’ are not smart!</pre>'
132132
assert result == expect
133+
134+
def test_github_issue_45():
135+
"""Incorrect transform unicode url"""
136+
text = '"test":https://myabstractwiki.ru/index.php/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0'
137+
result = textile.textile(text)
138+
expect = '\t<p><a href="https://myabstractwiki.ru/index.php/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0">test</a></p>'
139+
assert result == expect

textile/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ def encode_url(self, url):
943943
host = netloc_parsed['host']
944944
port = netloc_parsed['port'] and netloc_parsed['port']
945945
path = '/'.join( # could be encoded slashes!
946-
quote(unquote(pce).encode('utf8'), b'')
946+
quote(unquote(pce.encode('utf8')), b'')
947947
for pce in parsed.path.split('/')
948948
)
949949
fragment = quote(unquote(parsed.fragment))

0 commit comments

Comments
 (0)