UnicodeString

Converts things to unicode string, this is a specialization of the String class.

In addition to the String arguments, an encoding argument is also accepted. By default the encoding will be utf-8.

All converted strings are returned as Unicode strings.

>>> UnicodeString().to_python(None)
u''
>>> UnicodeString().to_python([])
u''
>>> UnicodeString(encoding='utf-7').to_python('Ni Ni Ni')
u'Ni Ni Ni'

Messages

badEncoding:
Invalid data or incorrect encoding
badType:
The input must be a string (not a %(type)s: %(value)r)
empty:
Please enter a value
noneType:
The input must be a string (not None)
tooLong:
Enter a value less than %(max)i characters long
tooShort:
Enter a value %(min)i characters long or more

Attributes

a encoding

'utf-8'

a strip

False

a use_builtins_gettext

True

a accept_python

True

a min

None

a list_joiner

', '

a __singletonmethods__

('to_python', 'from_python', 'message', 'all_messages', 'subvalidators')

a max

None

a gettextargs

{}

a declarative_count

28

a __unpackargs__

()

a compound

False

a not_empty

None

a __mutableattributes__

()

a repeating

False

Methods

f __call__(self, *args, **kw) ...

f __classinit__(cls, new_attrs) ...

f __sourcerepr__(self, source, binding=None) ...

f __classsourcerepr__(cls, source, binding=None) ...

f __initargs__(self, new_attrs) ...

f validate_other(self, value, state) ...

f __init__(self, inputEncoding=None, outputEncoding=None, **kw) ...

f empty_value(self, value) ...

See the source for more information.