@@ -95,9 +95,7 @@ _Py_device_encoding(int fd)
95
95
#else
96
96
if (_PyRuntime .preconfig .utf8_mode ) {
97
97
_Py_DECLARE_STR (utf_8 , "utf-8" );
98
- PyObject * encoding = & _Py_STR (utf_8 );
99
- Py_INCREF (encoding );
100
- return encoding ;
98
+ return Py_NewRef (& _Py_STR (utf_8 ));
101
99
}
102
100
return _Py_GetLocaleEncodingObject ();
103
101
#endif
@@ -879,10 +877,10 @@ _Py_EncodeLocaleEx(const wchar_t *text, char **str,
879
877
880
878
// Get the current locale encoding name:
881
879
//
882
- // - Return "UTF -8" if _Py_FORCE_UTF8_LOCALE macro is defined (ex: on Android)
883
- // - Return "UTF -8" if the UTF-8 Mode is enabled
880
+ // - Return "utf -8" if _Py_FORCE_UTF8_LOCALE macro is defined (ex: on Android)
881
+ // - Return "utf -8" if the UTF-8 Mode is enabled
884
882
// - On Windows, return the ANSI code page (ex: "cp1250")
885
- // - Return "UTF -8" if nl_langinfo(CODESET) returns an empty string.
883
+ // - Return "utf -8" if nl_langinfo(CODESET) returns an empty string.
886
884
// - Otherwise, return nl_langinfo(CODESET).
887
885
//
888
886
// Return NULL on memory allocation failure.
@@ -894,7 +892,7 @@ _Py_GetLocaleEncoding(void)
894
892
#ifdef _Py_FORCE_UTF8_LOCALE
895
893
// On Android langinfo.h and CODESET are missing,
896
894
// and UTF-8 is always used in mbstowcs() and wcstombs().
897
- return _PyMem_RawWcsdup (L"UTF -8" );
895
+ return _PyMem_RawWcsdup (L"utf -8" );
898
896
#else
899
897
900
898
#ifdef MS_WINDOWS
@@ -908,7 +906,7 @@ _Py_GetLocaleEncoding(void)
908
906
if (!encoding || encoding [0 ] == '\0' ) {
909
907
// Use UTF-8 if nl_langinfo() returns an empty string. It can happen on
910
908
// macOS if the LC_CTYPE locale is not supported.
911
- return _PyMem_RawWcsdup (L"UTF -8" );
909
+ return _PyMem_RawWcsdup (L"utf -8" );
912
910
}
913
911
914
912
wchar_t * wstr ;
0 commit comments