Package gmisclib :: Module g_ucode
[frames] | no frames]

Module g_ucode

source code

Functions to make unicode handling easier for Python 2.X.

Functions
 
u(s, encoding='utf-8')
Convert string-like objects to unicode.
source code
 
test() source code
 
e(s)
Encode unicode into a bytestring, for printing.
source code
Variables
  __package__ = 'gmisclib'

Imports: sys


Function Details

u(s, encoding='utf-8')

source code 

Convert string-like objects to unicode. The general idea is that, as soon as data comes into your program, you call u() on it to make sure it is unicode.

Note: u() should be idempotent: i.e. u(u(x)) == u(x)

e(s)

source code 

Encode unicode into a bytestring, for printing. The idea is that, just before you print anything, you call e() on the data to be printed.