Skip to content

bpo-41091: Remove recommendation in curses module documentation to initialize LC_ALL and encode strings#21159

Closed
manueljacob wants to merge 1 commit into
python:mainfrom
manueljacob:curses_documentation-encoding
Closed

bpo-41091: Remove recommendation in curses module documentation to initialize LC_ALL and encode strings#21159
manueljacob wants to merge 1 commit into
python:mainfrom
manueljacob:curses_documentation-encoding

Conversation

@manueljacob

@manueljacob manueljacob commented Jun 25, 2020

Copy link
Copy Markdown
Contributor

The recommendation to call locale.setlocale(locale.LC_ALL, '') is
problematic as it initializes all locale categories to the user
settings, which might be unintended and is not necessary for curses to
work correctly. Initializing LC_CTYPE is sufficient for nl_langinfo() to
return the correct encoding. Current versions of Python initialize
LC_CTYPE at interpreter startup. Therefore calling locale.setlocale()
should not be necessary at all.

The curses module automatically encodes strings. Therefore the
recommendation to manually encode strings is outdated.

https://bugs.python.org/issue41091

…itialize LC_ALL and encode strings

The recommendation to call `locale.setlocale(locale.LC_ALL, '')` is
problematic as it initializes all locale categories to the user
settings, which might be unintended and is not necessary for curses to
work correctly. Initializing LC_CTYPE is sufficient for nl_langinfo() to
return the correct encoding. Current versions of Python initialize
LC_CTYPE at interpreter startup. Therefore calling locale.setlocale()
should not be necessary at all.

The curses module automatically encodes strings. Therefore the
recommendation to manually encode strings is outdated.
@iritkatriel

Copy link
Copy Markdown
Member

This was removed in #91732.

@iritkatriel iritkatriel closed this Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge docs Documentation in the Doc dir needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants