Opened 3 years ago

Last modified 3 years ago

#11531 new defect

Cannot authenticate with accented chars

Reported by: anonymous Owned by: Nikolaos Papagrigoriou
Priority: normal Component: TracLdapAuthPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by Jun Omae)

If there is an accented char (like ò) in the login field, the authentication fails with the following error (see the last row):

Trac[store] DEBUG: LDAPAuth: Unexpected error: Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/ldapauth/", line 69, in check_password
    bind_cn = self._search_user(conn, user)
  File "build/bdist.linux-x86_64/egg/ldapauth/", line 129, in _search_user
    self.search_filter % user)
  File "/usr/lib/python2.6/dist-packages/ldap/", line 516, in search_s
    return self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout=self.timeout)
  File "/usr/lib/python2.6/dist-packages/ldap/", line 509, in search_ext_s
    msgid = self.search_ext(base,scope,filterstr,attrlist,attrsonly,serverctrls,clientctrls,timeout,sizelimit)
  File "/usr/lib/python2.6/dist-packages/ldap/", line 505, in search_ext
  File "/usr/lib/python2.6/dist-packages/ldap/", line 96, in _ldap_call
    result = func(*args,**kwargs)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf2' in position 39: ordinal not in range(128)

May be a solution could be to encode('utf-8')?

If this cannot be fixed in the TracLdapAuthPlugin code, what can be done to avoid this issue? Thanks

Attachments (0)

Change History (4)

comment:1 Changed 3 years ago by Jun Omae

Description: modified (diff)

comment:2 Changed 3 years ago by anonymous

Wondering how long is it needed to fix this issue? days? weeks? months? years?

comment:3 Changed 3 years ago by Nikolaos Papagrigoriou

It will take some time to fix it because I do not control an LDAP server where I could create users with usernames containing non-ascii characters. I.e. I have no way to easily reproduce your issue.

The problem seems to be related to how python-ldap treats unicode characters. See

I could provide a fix but I have no way to test it. Sorry for that.

Could you avoid usernames with non-ascii characters or convert the accented characters to non accented ones? For example, in German the character "ü" is converted to "ue".

comment:4 Changed 3 years ago by anonymous

Thanks for your reply.

You could create a virtual machine (eg debian) with openLDAP eg: sudo apt-get update sudo apt-get install slapd sudo apt-get install ldap-utils

and use Apache Directory Studio client to add some users

In the meanwhile I try to avoid non ascii chars. Regards

Modify Ticket

as new The owner will remain Nikolaos Papagrigoriou.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.