8000 gh-74940: Allow fallback to UTF-8 encoding on systems with no locales… · python/cpython@2763994 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2763994

Browse files
gh-74940: Allow fallback to UTF-8 encoding on systems with no locales installed (GH-14925)
This change removes the alias of the 'C' locale to 'en_US'. Because of this alias, it is currently impossible for an application to use setlocale() to specify a UTF-8 locale on a system that has no locales installed, but which supports the C.UTF-8 locale/encoding.
1 parent 31acfd7 commit 2763994

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Lib/locale.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ def getpreferredencoding(do_setlocale=True):
962962
'c.ascii': 'C',
963963
'c.en': 'C',
964964
'c.iso88591': 'en_US.ISO8859-1',
965-
'c.utf8': 'en_US.UTF-8',
965+
'c.utf8': 'C.UTF-8',
966966
'c_c': 'C',
967967
'c_c.c': 'C',
968968
'ca': 'ca_ES.ISO8859-1',
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The C.UTF-8 locale is no longer converted to en_US.UTF-8, enabling the use
2+
of UTF-8 encoding on systems which have no locales installed.

0 commit comments

Comments
 (0)
0