[Python-checkins] r60070 - python/trunk/Doc/library/curses.rst

georg.brandl python-checkins at python.org
Sat Jan 19 11:16:09 CET 2008


Author: georg.brandl
Date: Sat Jan 19 11:16:09 2008
New Revision: 60070

Modified:
   python/trunk/Doc/library/curses.rst
Log:
Amend curses docs by info how to write non-ascii characters.
Thanks to Jeroen Ruigrok van der Werven.


Modified: python/trunk/Doc/library/curses.rst
==============================================================================
--- python/trunk/Doc/library/curses.rst	(original)
+++ python/trunk/Doc/library/curses.rst	Sat Jan 19 11:16:09 2008
@@ -19,6 +19,19 @@
 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::
 


More information about the Python-checkins mailing list