scriptharness.unicode module

Scriptharness unicode compatibility.

Once scriptharness drops python 2.x support, this module can go away.

scriptharness.unicode.to_unicode(obj, encoding=u'utf-8')

Encode a string as unicode in python2.

http://farmdev.com/talks/unicode/

Parameters:
  • obj (str) – the string to encode
  • encoding (Optional[str]) – the encoding to use. Defaults to ‘utf-8’.
Returns:

obj – the encoded string

Return type:

unicode