summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2021-04-21 23:18:20 (GMT)
committerGitHub <noreply@github.com>2021-04-21 23:18:20 (GMT)
commitdc516ef8395d15da0ab225eb0dceb2e0581f51ca (patch)
tree2b0a3af7e37a33786248f0cc81b9175969d1625a /Modules/socketmodule.c
parentcdad2724e6f7426372901cc5dedd8a462ba046a6 (diff)
downloadcpython-dc516ef8395d15da0ab225eb0dceb2e0581f51ca.zip
cpython-dc516ef8395d15da0ab225eb0dceb2e0581f51ca.tar.gz
cpython-dc516ef8395d15da0ab225eb0dceb2e0581f51ca.tar.bz2
bpo-26227: Fixes decoding of host names on Windows from ANSI instead of UTF-8 (GH-25510)
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 23aab59..79559c0 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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);