diff --git a/django/contrib/auth/management/__init__.py b/django/contrib/auth/management/__init__.py
index 475dd25..6a8d5d3 100644
a
|
b
|
from django.core.management.base import CommandError
|
13 | 13 | from django.db import DEFAULT_DB_ALIAS, router |
14 | 14 | from django.db.models import get_models, signals |
15 | 15 | from django.utils import six |
| 16 | from django.utils.encoding import DEFAULT_LOCALE_ENCODING |
16 | 17 | from django.utils.six.moves import input |
17 | 18 | |
18 | 19 | |
… |
… |
def get_system_username():
|
133 | 134 | # (a very restricted chroot environment, for example). |
134 | 135 | return '' |
135 | 136 | if not six.PY3: |
136 | | default_locale = locale.getdefaultlocale()[1] |
137 | | if not default_locale: |
138 | | return '' |
139 | 137 | try: |
140 | | result = result.decode(default_locale) |
| 138 | result = result.decode(DEFAULT_LOCALE_ENCODING) |
141 | 139 | except UnicodeDecodeError: |
142 | 140 | # UnicodeDecodeError - preventive treatment for non-latin Windows. |
143 | 141 | return '' |
diff --git a/django/utils/encoding.py b/django/utils/encoding.py
index 68929cc..6c3a9de 100644
a
|
b
|
def filepath_to_uri(path):
|
240 | 240 | try: |
241 | 241 | DEFAULT_LOCALE_ENCODING = locale.getdefaultlocale()[1] or 'ascii' |
242 | 242 | codecs.lookup(DEFAULT_LOCALE_ENCODING) |
243 | | except: |
| 243 | except Exception: |
244 | 244 | DEFAULT_LOCALE_ENCODING = 'ascii' |