Opened 16 years ago
Last modified 14 years ago
#9935 closed
When used with Oracle XE, admin page throws UnicodeEncodeError — at Initial Version
Reported by: | jamesli | Owned by: | nobody |
---|---|---|---|
Component: | contrib.sessions | Version: | 1.0 |
Severity: | Keywords: | oracle session unicode UnicodeEncodeError | |
Cc: | Goldan | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I can reproduce the problem with the following environment:
Windows XP Pro
Python 2.5.2
Oracle 10g XE (Universal)
Django 1.0.2 final
(I tend to think it is a Django/Oracle combination problem, because I can't reproduce the bug with MySQL or Postgres.)
I was walking through the tutorial, during which I installed the 'admin' site. I went to http://127.0.0.1:8000/admin/ and logged in with user name and password, and then hit the following error.
UnicodeEncodeError at /admin/
'ascii' codec can't encode characters in position 0-42: ordinal not in range(128)
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/
Exception Type: UnicodeEncodeError
Exception Value:
'ascii' codec can't encode characters in position 0-42: ordinal not in range(128)
Exception Location: C:\Python25\lib\base64.py in decodestring, line 321
Python Executable: C:\Python25\python.exe
Python Version: 2.5.2
Python Path: ['C:
django
mysite', 'C:
IBMTOOLS
utils
support', 'C:
IBMTOOLS
utils
logger', 'C:
WINDOWS
system32
python25.zip', 'C:
Python25
DLLs', 'C:
Python25
lib', 'C:
Python25
lib
plat-win', 'C:
Python25
lib
lib-tk', 'C:
Python25', 'C:
Python25
lib
site-packages']
Server time: Tue, 30 Dec 2008 19:42:28 -0800
Unicode error hint
The string that could not be encoded/decoded was: 䅧㥊兣噆湃汒㍣橒㉢爹坡硖汁䝕㉤礹㉡歖兣穎浌穑呏硫坚歊浍㑍呎祉呙硉䝏㉍橙穑呚橊娊則奫婺੬zOTkx
Traceback:
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/
Django Version: 1.0.2 final
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "C:\Python25\Lib\site-packages\django\core\handlers\base.py" in get_response
- response = callback(request, *callback_args, callback_kwargs)
File "C:\Python25\Lib\site-packages\django\contrib\admin\sites.py" in root
- if not self.has_permission(request):
File "C:\Python25\Lib\site-packages\django\contrib\admin\sites.py" in has_permission
- return request.user.is_authenticated() and request.user.is_staff
File "C:\Python25\Lib\site-packages\django\contrib\auth\middleware.py" in get
- request._cached_user = get_user(request)
File "C:\Python25\Lib\site-packages\django\contrib\auth\init.py" in get_user
- user_id = request.session[SESSION_KEY]
File "C:\Python25\Lib\site-packages\django\contrib\sessions\backends\base.py" in getitem
- return self._session[key]
File "C:\Python25\Lib\site-packages\django\contrib\sessions\backends\base.py" in _get_session
- self._session_cache = self.load()
File "C:\Python25\Lib\site-packages\django\contrib\sessions\backends\db.py" in load
- return self.decode(force_unicode(s.session_data))
File "C:\Python25\Lib\site-packages\django\contrib\sessions\backends\base.py" in decode
- encoded_data = base64.decodestring(session_data)
File "C:\Python25\lib\base64.py" in decodestring
- return binascii.a2b_base64(s)
Exception Type: UnicodeEncodeError at /admin/
Exception Value: 'ascii' codec can't encode characters in position 0-42: ordinal not in range(128)