whois/__init__.py
changeset 35 0de2468a27e8
parent 33 8c4c05eb65f4
child 38 da8f2956db7e
--- a/whois/__init__.py	Fri Aug 15 13:31:24 2014 +0300
+++ b/whois/__init__.py	Fri Aug 15 17:11:52 2014 +0300
@@ -58,12 +58,17 @@
 
     url = re.sub('^.*://', '', url).split('/')[0].lower()
     domain = []
-    for section in url.split('.'):
+    url_sections = (
+        section.decode('utf-8').encode('idna')
+        for section in url.split('.')
+    )
+
+    for section in url_sections:
         if section in suffixes:
             domain.append(section)
         else:
             domain = [section]
-    return '.'.join(domain)
+    return '.'.join(domain).decode('idna').encode('utf-8')
 
 
 if __name__ == '__main__':