summaryrefslogtreecommitdiffstats
path: root/pykolab/utils.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-11-19 21:27:09 -0500
committerThomas Bruederli <bruederli@kolabsys.com>2014-11-19 21:27:09 -0500
commitd49a7ea6c05521995afa8b73fcf0e638931f83d9 (patch)
tree0dba2a27ac7e09bd59ea01d789855f78c6daaa78 /pykolab/utils.py
parentd65762d548ef3869db2947d7f74434708c0b0820 (diff)
downloadpykolab-d49a7ea6c05521995afa8b73fcf0e638931f83d9.tar.gz
Build iTip response and notification messages with unicode strings (#3926) + adjust tests
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 = []