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.
And I should mention that on other platforms it could use punycode. Simply doing:
hostname = socket. gethostname( ) startswith( 'xn--') : 4:].decode( 'punycode' )
if hostname.
return hostname[
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.