mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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
2 changed files with 3 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue