This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients abarry, vstinner
Date 2016-01-28.01:10:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1453943415.23.0.44809658142.issue26226@psf.upfronthosting.co.za>
In-reply-to
Content
Python 2.7.11:

>>> import socket
>>> socket.gethostname()
'\xc9manuel-PC'

This one works on Python 3 because the Python function is implemented with a call to the Windows native API.

>>> socket.gethostbyaddr(socket.gethostname())
('\xc9manuel-PC.home', [], ['fe80::c9b7:5117:eea4:a104'])

This one fails on Python 3 because it uses the gethostbyaddr() C function and then decodes the hostname from UTF-8, whereas the hostname looks more to be encoded to ISO 8859-1 or something like that. IMHO it should be decoded from the ANSI code page.

I opened the issue #26227 to track this bug.
History
Date User Action Args
2016-01-28 01:10:15vstinnersetrecipients: + vstinner, abarry
2016-01-28 01:10:15vstinnersetmessageid: <1453943415.23.0.44809658142.issue26226@psf.upfronthosting.co.za>
2016-01-28 01:10:15vstinnerlinkissue26226 messages
2016-01-28 01:10:15vstinnercreate