Miscellaneous Unicode and internationalization utilities
Imported modules
|
|
import codecs
|
Functions
|
|
uopen
utf8orlatin1
utrunc
|
|
uopen
|
uopen (
fn,
mode='rb',
encoding='utf8',
errors='strict',
buffering=1,
)
Open a file named by fn with mode mode whose contents are
encoded using encoding (default utf8), where we will be
reading and writing data as unicode strings
|
|
utf8orlatin1
|
utf8orlatin1 ( aStr )
Convert string aStr to a unicode string. First, hope that it is utf8,
but if it doesn't seem to be, assume it was latin1.
|
|
utrunc
|
utrunc ( s, l )
Return an initial substring of s where
the utf8 representation takes no more than l bytes Useful for safely truncating unicode strings for storage in utf8
form in database fields that put an upper limit on length.
|
Classes
|
|
UnicodeO |
Like StringIO, but output only, and allows unicode strings for write()
|
|
|