[issue10097] platform.uname gives UnicodeError for non-ASCII computer names on Windows
Marc-Andre Lemburg
report at bugs.python.org
Thu Oct 14 10:53:26 CEST 2010
Marc-Andre Lemburg <mal at egenix.com> added the comment:
Marc-Andre Lemburg wrote:
> 2. COMPUTERNAME returns an uppercase version of the host name (which we
> could lowercase to stay b/w compatible), however I'm not sure
> whether this is the same as the socket.gethostname() or the
> NETBIOS name and I'm also not sure whether this is always set.
>
> This link suggests that it's using the NetBIOS name:
> http://www.scriptlogic.com/support/CustomScripts/environmentVariableReference.html
>
> The official Microsoft page is unclear about this:
> http://technet.microsoft.com/en-gb/library/bb490954.aspx
More evidence that the NetBIOS name is used:
http://msdn.microsoft.com/en-us/library/aa368009(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms724295(v=VS.85).aspx
One problem with this approach is that changes to the NetBIOS name
are not seen by those APIs and variables, e.g. if the machine
get's an update via DHCP. The other is that NetBIOS itself is
being phased out in favor of DNS names - which socket.gethostname()
returns, so we'd be replacing a new technology with an old one.
http://blogs.technet.com/b/networking/archive/2008/12/16/netbios-browsing-and-windows-server-2008-x64-server-core.aspx
BTW: Why doesn't socket.gethostname() use GetComputerNameEx()
which does support Unicode ?
See http://msdn.microsoft.com/en-us/library/ms724301(v=VS.85).aspx
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10097>
_______________________________________
More information about the Python-bugs-list
mailing list