Skip to content

Commit

Permalink
Don’t encode tildes in encodelink()
Browse files Browse the repository at this point in the history
Resolves issue #2377.
  • Loading branch information
da2x committed Jun 17, 2016
1 parent 839358f commit 02affdc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nikola/utils.py
Expand Up @@ -805,7 +805,7 @@ def encodelink(iri):
"""Given an encoded or unencoded link string, return an encoded string suitable for use as a link in HTML and XML."""
iri = unicodenormalize('NFC', iri)
link = OrderedDict(urlparse(iri)._asdict())
link['path'] = urlquote(urlunquote(link['path']).encode('utf-8'))
link['path'] = urlquote(urlunquote(link['path'], safe="/~").encode('utf-8'))
try:
link['netloc'] = link['netloc'].encode('utf-8').decode('idna').encode('idna').decode('utf-8')
except UnicodeDecodeError:
Expand Down

0 comments on commit 02affdc

Please sign in to comment.