diff options
author | Lance Stout <lancestout@gmail.com> | 2012-12-18 10:33:33 -0800 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-12-18 10:33:33 -0800 |
commit | 29c049612a181e480371f3a686170a87af1e9f98 (patch) | |
tree | dbb745d4f90296ccda720272b5b0c7f57252e147 /sleekxmpp/util/misc_ops.py | |
parent | f431bbfca2b9862f954e25d7dd234a9131bc2ee1 (diff) | |
parent | ed481857326606603f70ef06dbd5a4b48d1b9510 (diff) | |
download | slixmpp-29c049612a181e480371f3a686170a87af1e9f98.tar.gz slixmpp-29c049612a181e480371f3a686170a87af1e9f98.tar.bz2 slixmpp-29c049612a181e480371f3a686170a87af1e9f98.tar.xz slixmpp-29c049612a181e480371f3a686170a87af1e9f98.zip |
Merge branch 'master' into develop
Diffstat (limited to 'sleekxmpp/util/misc_ops.py')
-rw-r--r-- | sleekxmpp/util/misc_ops.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sleekxmpp/util/misc_ops.py b/sleekxmpp/util/misc_ops.py index 3b246625..c2533eec 100644 --- a/sleekxmpp/util/misc_ops.py +++ b/sleekxmpp/util/misc_ops.py @@ -8,7 +8,10 @@ def unicode(text): text = text.decode('utf-8') import __builtin__ return __builtin__.unicode(text) - return str(text) + elif not isinstance(text, str): + return text.decode('utf-8') + else: + return text def bytes(text): @@ -148,4 +151,4 @@ def setdefaultencoding(encoding): if func is None: raise RuntimeError("Could not find setdefaultencoding") sys.setdefaultencoding = func - return func(encoding)
\ No newline at end of file + return func(encoding) |