summaryrefslogtreecommitdiffstats
path: root/pykolab/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'pykolab/utils.py')
-rw-r--r--pykolab/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/pykolab/utils.py b/pykolab/utils.py
index d34daeb..f91ed8d 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -309,6 +309,15 @@ def stripped_message(message):
return "\n%s\n" % ("\n".join(lines))
+def str2unicode(s, encoding='utf-8'):
+ if isinstance(s, unicode):
+ return s
+ try:
+ return unicode(s, encoding)
+ except:
+ pass
+ return s
+
def normalize(_object):
if type(_object) == list:
result = []