summaryrefslogtreecommitdiffstats
path: root/ipa_server/ipautil.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipa_server/ipautil.py')
-rw-r--r--ipa_server/ipautil.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/ipa_server/ipautil.py b/ipa_server/ipautil.py
index 6b0e2c89..6422fe5a 100644
--- a/ipa_server/ipautil.py
+++ b/ipa_server/ipautil.py
@@ -188,3 +188,14 @@ def get_gsserror(e):
secondary = e[0][1]
return (primary[0], secondary[0])
+
+def utf8_encode_value(value):
+ if isinstance(value,unicode):
+ return value.encode('utf-8')
+ return value
+
+def utf8_encode_values(values):
+ if isinstance(values,list) or isinstance(values,tuple):
+ return map(utf8_encode_value, values)
+ else:
+ return utf8_encode_value(values)