mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-24 01:40:23 +00:00
coerce to unicode in url_norm if arg was unicode
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2845 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
8cfcbf075a
commit
fccccac818
1 changed files with 3 additions and 0 deletions
|
|
@ -192,6 +192,7 @@ def idna_encode (host):
|
|||
"""
|
||||
Encode hostname as internationalized domain name (IDN) according
|
||||
to RFC 3490.
|
||||
@raise: UnicodeError if hostname is not properly IDN encoded.
|
||||
"""
|
||||
if host and isinstance(host, unicode):
|
||||
uhost = host.encode('idna').decode('ascii')
|
||||
|
|
@ -325,6 +326,8 @@ def url_norm (url):
|
|||
if url.endswith('#') and not urlparts[4]:
|
||||
# re-append trailing empty fragment
|
||||
res += '#'
|
||||
if isinstance(url, unicode):
|
||||
res = unicode(res)
|
||||
return (res, is_idn)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue