mirror of
https://github.com/python/cpython.git
synced 2026-04-23 12:21:01 +00:00
bpo-34527: POSIX locale enables the UTF-8 Mode (GH-8972) (GH-8974)
* The UTF-8 Mode is now also enabled by the "POSIX" locale, not only
by the "C" locale.
* On FreeBSD, Py_DecodeLocale() and Py_EncodeLocale() now also forces
the ASCII encoding if the LC_CTYPE locale is "POSIX", not only if
the LC_CTYPE locale is "C".
* test_utf8_mode.test_cmd_line() checks also that the command line
arguments are decoded from UTF-8 when the the UTF-8 Mode is enabled
with POSIX locale or C locale.
(cherry picked from commit 5cb258950c)
This commit is contained in:
parent
e3f20828f6
commit
65ef7425a3
5 changed files with 39 additions and 13 deletions
|
|
@ -128,7 +128,7 @@ check_force_ascii(void)
|
|||
loc = setlocale(LC_CTYPE, NULL);
|
||||
if (loc == NULL)
|
||||
goto error;
|
||||
if (strcmp(loc, "C") != 0) {
|
||||
if (strcmp(loc, "C") != 0 && strcmp(loc, "POSIX") != 0) {
|
||||
/* the LC_CTYPE locale is different than C */
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue