Skip to content
Permalink
Browse files
Don’t encode tildes in encodelink()
Resolves issue #2377.
  • Loading branch information
da2x committed Jun 17, 2016
1 parent 839358f commit 02affdcc3cd3e94cd35c016b8b18b1360a9d1797
Showing with 1 addition and 1 deletion.
  1. +1 −1 nikola/utils.py
@@ -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:

0 comments on commit 02affdc

Please sign in to comment.