diff --git a/ipalib/parameters.py b/ipalib/parameters.py index feccd7eaa..5c386c324 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -1014,7 +1014,7 @@ class Int(Number): """ if type(value) in (int, long): return value - if type(value) is unicode: + if type(value) in (str, unicode): # permit floating point strings if value.find(u'.') >= 0: try: @@ -1247,6 +1247,14 @@ class Str(Data): """ if type(value) is self.type: return value + if type(value) is str: + try: + return value.decode('utf-8') + except UnicodeDecodeError: + raise ConversionError( + name=self.name, index=index, + error=ugettext(self.scalar_error) + ) if type(value) in (int, float): return self.type(value) if type(value) in (tuple, list):