mirror of https://github.com/flaggo/pydu.git
add doc for safeunicode
This commit is contained in:
parent
8063e651fa
commit
97d2738569
|
@ -191,3 +191,14 @@ String
|
|||
>>> strips('foobarfoo', 'foo')
|
||||
'bar'
|
||||
|
||||
|
||||
.. function:: pydu.utils.safeunicode(obj, encoding='utf-8')
|
||||
|
||||
Converts any given object to unicode string.
|
||||
|
||||
>>> safeunicode('hello')
|
||||
u'hello'
|
||||
>>> safeunicode(2)
|
||||
u'2'
|
||||
>>> safeunicode('\xe4\xb8\xad\xe6\x96\x87')
|
||||
u'中文'
|
||||
|
|
Loading…
Reference in New Issue