-
-
Notifications
You must be signed in to change notification settings - Fork 31k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-47000: Add locale.getencoding()
#32068
Changes from 7 commits
cd4bccc
aaa8956
104206a
8b50eb1
a0204c2
08413f1
f61b622
1c60e5b
7397493
44730dd
7720b10
104008d
a8e50bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -334,10 +334,23 @@ The :mod:`locale` module defines the following exception and functions: | |||||
locale. See also the :term:`filesystem encoding and error handler`. | ||||||
|
||||||
.. versionchanged:: 3.7 | ||||||
The function now always returns ``UTF-8`` on Android or if the | ||||||
The function now always returns ``"UTF-8"`` on Android or if the | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
:ref:`Python UTF-8 Mode <utf8-mode>` is enabled. | ||||||
|
||||||
|
||||||
.. function:: getencoding() | ||||||
|
||||||
Returns the :term:`locale encoding`. | ||||||
methane marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
On Android, it always returns ``"UTF-8"``, the :term:`locale encoding` is | ||||||
ignored. | ||||||
|
||||||
This function is same to ``getpreferredencoding(False)`` except this | ||||||
methane marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
function ignore the :ref:`UTF-8 Mode <utf8-mode>`. | ||||||
methane marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
.. versionadded:: 3.11 | ||||||
|
||||||
|
||||||
.. function:: normalize(localename) | ||||||
|
||||||
Returns a normalized locale code for the given locale name. The returned locale | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -274,6 +274,12 @@ inspect | |||||
* Add :func:`inspect.ismethodwrapper` for checking if the type of an object is a | ||||||
:class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik in :issue:`29418`.) | ||||||
|
||||||
locale | ||||||
------ | ||||||
|
||||||
* Add :func:`locale.getencoding` that is same to | ||||||
methane marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
``locale.getpreferredencoding(False)`` but ignores :ref:`UTF-8 Mode <utf8-mode>`. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like repeating "Python" to remind that it's unrelated to the Unix locale, but really something specific to Python which ignores the locale.
Suggested change
|
||||||
|
||||||
math | ||||||
---- | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add :func:`locale.getencoding`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can copy/paste the Doc/whatsnew/3.11.rst entry entry. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to copy/paste this paragraph to getencoding() doc.