From fccccac818bbf69422a66d608ed86e69596c7fae Mon Sep 17 00:00:00 2001 From: calvin Date: Tue, 11 Oct 2005 12:09:16 +0000 Subject: [PATCH] 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 --- linkcheck/url.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linkcheck/url.py b/linkcheck/url.py index b37884b5..d4708ec1 100644 --- a/linkcheck/url.py +++ b/linkcheck/url.py @@ -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)