Comment 7 for bug 256550

Revision history for this message
John A Meinel (jameinel) wrote :

And I should mention that on other platforms it could use punycode. Simply doing:

hostname = socket.gethostname()
if hostname.startswith('xn--'):
  return hostname[4:].decode('punycode')

Just for reference, u'samus\xb5\xe5\u0192'.encode('punycode') == 'samus-ija05a89b'

I don't know if there is a "standard" way on other platforms to handle non-ascii domain names, *other* than punycode.