mirror of
https://github.com/python/cpython.git
synced 2025-10-19 16:03:42 +00:00
gh-74857, PEP 538: Coerce POSIX locale to UTF-8 based locale (#139238)
This commit is contained in:
parent
a79ce35c70
commit
e8382e55c5
3 changed files with 10 additions and 9 deletions
|
@ -209,7 +209,10 @@ _Py_LegacyLocaleDetected(int warn)
|
|||
* we may also want to check for that explicitly.
|
||||
*/
|
||||
const char *ctype_loc = setlocale(LC_CTYPE, NULL);
|
||||
return ctype_loc != NULL && strcmp(ctype_loc, "C") == 0;
|
||||
if (ctype_loc == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return (strcmp(ctype_loc, "C") == 0 || strcmp(ctype_loc, "POSIX") == 0);
|
||||
#else
|
||||
/* Windows uses code pages instead of locales, so no locale is legacy */
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue