mirror of https://github.com/python/cpython
bpo-26227: Fixes decoding of host names on Windows from ANSI instead of UTF-8 (GH-25510)
This commit is contained in:
parent
cdad2724e6
commit
dc516ef839
|
@ -0,0 +1,2 @@
|
|||
Fixed decoding of host names in :func:`socket.gethostbyaddr` and
|
||||
:func:`socket.gethostbyname_ex`.
|
|
@ -5508,7 +5508,7 @@ sock_decode_hostname(const char *name)
|
|||
#ifdef MS_WINDOWS
|
||||
/* Issue #26227: gethostbyaddr() returns a string encoded
|
||||
* to the ANSI code page */
|
||||
return PyUnicode_DecodeFSDefault(name);
|
||||
return PyUnicode_DecodeMBCS(name, strlen(name), "surrogatepass");
|
||||
#else
|
||||
/* Decode from UTF-8 */
|
||||
return PyUnicode_FromString(name);
|
||||
|
|
Loading…
Reference in New Issue