Eryk Sun added the comment:

The patch is missing the "errors" parameter of PyUnicode_DecodeLocale. But it 
should call PyUnicode_DecodeMBCS instead. In the "C" locale, 
PyUnicode_DecodeLocale is Latin-1 because the CRT mbstowcs just casts the 
values to wchar_t.

socket_getnameinfo also decodes as UTF-8:

    >>> socket.getnameinfo(('127.0.0.1', 20), 0)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 0: 
invalid start byte

Steve, does your suggestion include reimplementing socket.gethostbyaddr and 
socket.gethostbyname_ex using GetNameInfoW and GetAddrInfoW? gethostbyaddr and 
gethostbyname are deprecated and lack a Unicode implementation.

----------
nosy: +eryksun

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26227>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to