diff options
author | Georg Brandl <georg@python.org> | 2008-01-19 10:16:09 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-01-19 10:16:09 (GMT) |
commit | a7d70fd4389f321ab3e34df08a61ec0d9ab262b2 (patch) | |
tree | 4c700d7cfc11ddcd3651105203103511d0f66d7c /Doc | |
parent | f8e6afbb66c6828469e7600f64b5107b92110d1c (diff) | |
download | cpython-a7d70fd4389f321ab3e34df08a61ec0d9ab262b2.zip cpython-a7d70fd4389f321ab3e34df08a61ec0d9ab262b2.tar.gz cpython-a7d70fd4389f321ab3e34df08a61ec0d9ab262b2.tar.bz2 |
Amend curses docs by info how to write non-ascii characters.
Thanks to Jeroen Ruigrok van der Werven.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/curses.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst index 22cb626..93a57ba 100644 --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -19,6 +19,19 @@ for DOS, OS/2, and possibly other systems as well. This extension module is designed to match the API of ncurses, an open-source curses library hosted on Linux and the BSD variants of Unix. +.. note:: + + Since version 5.4, the ncurses library decides how to interpret non-ASCII data + using the ``nl_langinfo`` function. That means that you have to call + :func:`locale.setlocale` in the application and use one of the system's + available encodings to encode Unicode strings with it. This example uses the + system's default encoding:: + + import locale + locale.setlocale(locale.LC_ALL, '') + code = locale.getpreferredencoding() + + Then use *code* as the encoding for :meth:`str.encode` calls. .. seealso:: |