diff --git a/django/contrib/auth/management/__init__.py b/django/contrib/auth/management/__init__.py
index 9966849..1e1aaa0 100644
a
|
b
|
def get_system_username():
|
83 | 83 | :returns: The username as a unicode string, or an empty string if the |
84 | 84 | username could not be determined. |
85 | 85 | """ |
86 | | try: |
87 | | return getpass.getuser().decode(locale.getdefaultlocale()[1]) |
88 | | except (ImportError, KeyError, UnicodeDecodeError): |
89 | | # KeyError will be raised by os.getpwuid() (called by getuser()) |
90 | | # if there is no corresponding entry in the /etc/passwd file |
91 | | # (a very restricted chroot environment, for example). |
92 | | # UnicodeDecodeError - preventive treatment for non-latin Windows. |
93 | | return u'' |
| 86 | default_locale = locale.getdefaultlocale()[1] |
| 87 | if default_locale: |
| 88 | try: |
| 89 | return getpass.getuser().decode(default_locale) |
| 90 | except (ImportError, KeyError, UnicodeDecodeError): |
| 91 | # KeyError will be raised by os.getpwuid() (called by getuser()) |
| 92 | # if there is no corresponding entry in the /etc/passwd file |
| 93 | # (a very restricted chroot environment, for example). |
| 94 | # UnicodeDecodeError - preventive treatment for non-latin Windows. |
| 95 | pass |
| 96 | return u'' |
94 | 97 | |
95 | 98 | |
96 | 99 | def get_default_username(check_db=True): |