[kupfer] Update manual on Text and Encodings



commit b1925e4bbb8bbeac401354cb85f489339a72a26e
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Mon May 24 01:24:31 2010 +0200

    Update manual on Text and Encodings

 Documentation/Manual.rst |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/Documentation/Manual.rst b/Documentation/Manual.rst
index 4d46d2c..eb712b1 100644
--- a/Documentation/Manual.rst
+++ b/Documentation/Manual.rst
@@ -187,17 +187,6 @@ simplified version of Source.
 ``provides()``
     Return a sequence of the Leaf types it may contain
 
-Strings
--------
-
-Kupfer deals with PyGTK a lot, which always returns UTF-8-encoded
-strings (almost always). However Kupfer works internally with unicode
-strings; only then does slicing, lowercasing etc work across other than
-ascii charsets.
-Kupfer accepts UTF-8-encoded strings as well as unicode objects for the
-most parts, but all internals should be unicode. Note that the gettext
-function ``_()`` will return a unicode string.
-
 Plugins
 -------
 
@@ -358,6 +347,25 @@ class and rename it, which you often do to create new plugins, the
 second version does not need to be updated -- you are probably using the
 same superclass.
 
+Text and Encodings
+..................
+
+Care must be taken with all input and output text and its encoding!
+Internally, kupfer must use ``unicode`` for all internal text.
+The module ``kupfer.kupferstring`` has functions for the most important
+text conversions.
+
+A good introduction to unicode in Python is to read here:
+http://farmdev.com/talks/unicode/
+
+**Always** find out what encoding you must expect for externally read
+text (from files or command output). If you must guess, use the locale
+encoding.
+Text received from PyGTK is either already unicode or in the UTF-8
+encoding, so this text can be passed to ``kupferstring.tounicode``.
+
+Note that the gettext function ``_()`` always returns a unicode string.
+
 
 Localization
 ============



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]