I\'m wondering what\'s the best way -- or if there\'s a simple way with the standard library -- to convert a URL with Unicode chars in the domain name and path to the equiva
You might use urlparse.urlsplit instead, but otherwise you seem to have a very straightforward solution, there.
protocol, domain, path, query, fragment = urlparse.urlsplit(url)
(You can access the domain and port separately by accessing the returned value's named properties, but as port syntax is always in ASCII it is unaffected by the IDNA encoding process.)