|
710 |
|
710 |
|
711 |
|
711 |
|
712 |
def compatible_list(list): |
712 |
def compatible_list(list): |
713 |
return encode_list(decode_list(list, 'latin'), 'utf8') |
713 |
return encode_list(decode_list(list, 'latin1'), 'utf8') |
714 |
|
714 |
|
715 |
|
715 |
|
716 |
def compatible_modlist(list): |
716 |
def compatible_modlist(list): |
717 |
return encode_modlist(decode_modlist(list, 'latin'), 'utf8') |
717 |
return encode_modlist(decode_modlist(list, 'latin1'), 'utf8') |
718 |
|
718 |
|
719 |
|
719 |
|
720 |
def compatible_addlist(list): |
720 |
def compatible_addlist(list): |
721 |
return encode_addlist(decode_addlist(list, 'latin'), 'utf8') |
721 |
return encode_addlist(decode_addlist(list, 'latin1'), 'utf8') |
722 |
|
722 |
|
723 |
|
723 |
|
724 |
def compatible_modstring(string): |
724 |
def compatible_modstring(string): |
725 |
if hasattr(string, 'decode') and not isinstance(string, types.UnicodeType): |
725 |
if hasattr(string, 'decode') and not isinstance(string, types.UnicodeType): |
726 |
string = string.decode('latin') |
726 |
string = string.decode('latin1') |
727 |
if hasattr(string, 'encode'): |
727 |
if hasattr(string, 'encode'): |
728 |
string = string.encode('utf8') |
728 |
string = string.encode('utf8') |
729 |
return string |
729 |
return string |
|
991 |
try: |
991 |
try: |
992 |
return unicode(string) |
992 |
return unicode(string) |
993 |
except: # FIXME: which exception is to be caught? |
993 |
except: # FIXME: which exception is to be caught? |
994 |
return unicode(string, 'Latin-1') |
994 |
return unicode(string, 'latin1') |
995 |
|
995 |
|
996 |
def _get_lastUSN(self): |
996 |
def _get_lastUSN(self): |
997 |
_d = ud.function('ldap._get_lastUSN') |
997 |
_d = ud.function('ldap._get_lastUSN') |
|
1019 |
def __encode_GUID(self, GUID): |
1019 |
def __encode_GUID(self, GUID): |
1020 |
# GUID may be unicode |
1020 |
# GUID may be unicode |
1021 |
if isinstance(GUID, type(u'')): |
1021 |
if isinstance(GUID, type(u'')): |
1022 |
return GUID.encode('ISO-8859-1').encode('base64') |
1022 |
return GUID.encode('latin1').encode('base64') |
1023 |
else: |
1023 |
else: |
1024 |
return unicode(GUID, 'latin').encode('ISO-8859-1').encode('base64') |
1024 |
return GUID.encode('base64') |
1025 |
|
1025 |
|
1026 |
def _get_DN_for_GUID(self, GUID): |
1026 |
def _get_DN_for_GUID(self, GUID): |
1027 |
_d = ud.function('ldap._get_DN_for_GUID') |
1027 |
_d = ud.function('ldap._get_DN_for_GUID') |