#10241 closed (invalid)
read a (non-ascii) characte file name : 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | File uploads/storage | Version: | 1.0 |
Severity: | Keywords: | read a (non-ascii) character file name a unicode (non-ascii) character filename | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
when read "/admin/filebrowser/File/中文文件名" a (non-ascii) characte file name
Unicode error hint
UnicodeDecodeError at /admin/filebrowser/File/
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128))
Traceback: File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response 86. response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.5/site-packages/django/contrib/admin/views/decorators.py" in _checklogin 33. return view_func(request, *args, **kwargs) File "/usr/lib/python2.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func 44. response = view_func(request, *args, **kwargs) File "/home/virtualhost/lfreeren/dllb.cn/public_html/new/org/filebrowser/views.py" in index 64. var_filesize_long = os.path.getsize(os.path.join(PATH_SERVER, path, file)) File "/usr/lib/python2.5/posixpath.py" in join 63. path += b Exception Type: UnicodeDecodeError at /admin/filebrowser/File/ Exception Value: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)
Change History (5)
comment:1 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 16 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
follow-up: 4 comment:3 by , 16 years ago
The same code django0.96 operating normally,
Django1.0 running in error
comment:4 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
Replying to isoemail@163.com:
The same code django0.96 operating normally,
Django1.0 running in error
That's probably because of the unicode changes that happened between 0.96 and 1.0, listed on BackwardsIncompatibleChanges
If you can show that this is really a bug in Django itself then re-open.
The traceback is generated in an
index
view contained in afilebrowser/views.py
file that isn't included with Django, it seems to be part of your application or a third party application so I don't think this is a Django problem.PS: It seems to happen when trying to calculate some file size So the best thing to do would be to review the Python documentation for the functions involved in that failing code (
os.path.getsize
.os.path.join
) in regard to handling of non-ASCII paths.