Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeEncodeError: 'ascii' codec can't encode character #8

Open
GoogleCodeExporter opened this issue May 15, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Having a user with nonascii characters in lastName.

2. Command: syncOneUser uid=usuario

3.

What is the expected output? What do you see instead?

It was spected:

The user record for uid=ilegon,ou=people,dc=desic-sl,dc=com is now:
Now looking up 'ilegon' in Google Apps for Your Domain...
Google Apps for Your Domain returned the following data:
userName                      : usuario
firstName                     : Manuel
lastName                      : Legón
accountStatus                 : unlocked
emailLists                    : 
aliases                       :
Google Apps for Your Domain matches your database, and
your database matches LDAP. No action needed.

I see this, instead:

Command: syncOneUser uid=usuario
The user record for uid=usuario,ou=people,dc=xxxx,dc=xxx is now:
Now looking up 'ilegon' in Google Apps for Your Domain...
Google Apps for Your Domain returned the following data:
userName                      : usuario
firstName                     : Manuel
Traceback (most recent call last):
  File "sync_ldap.py", line 178, in ?
    (config, ldap_context, user_database, google_context, log_config) = \
  File "sync_ldap.py", line 107, in DoMain
    cmd.cmdloop()
  File "/usr/lib/python2.4/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python2.4/cmd.py", line 219, in onecmd
    return func(arg)
  File "/root/ldap-sync/google-apps-for-your-domain-ldap-sync/commands.py",
line 623, in do_syncOneUser
    user_rec = self._FetchOneUser(username)
  File "/root/ldap-sync/google-apps-for-your-domain-ldap-sync/commands.py",
line 916, in _FetchOneUser
    self._PrintGoogleUserRec(user_rec)
  File "/root/ldap-sync/google-apps-for-your-domain-ldap-sync/commands.py",
line 1026, in _PrintGoogleUserRec
    print '%-30s: %s' % (str(key), str(val))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in
position 3: ordinal not in range(128)

What version of the product are you using? On what operating system?

Revision: 59. Linux.

Please provide any additional information below.

Changing command.py, line 1026 from:

      print '%-30s: %s' % (str(key), str(val))

to:

      print '%-30s: %s' % (str(key), val)

it works.

Original issue reported on code.google.com by eduardo....@gmail.com on 6 Mar 2008 at 12:56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant