Opened 20 years ago
Closed 18 years ago
#2981 closed defect (worksforme)
unable to upload files which filename is non-english characters
| Reported by: | anonymous | Owned by: | Christian Boos | 
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | general | Version: | devel | 
| Severity: | normal | Keywords: | attachment unicode windows | 
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
With 0.10dev, while attaching a filename in asian-characters. Attachment function is broken. for example, 中文.txt became %E4%B8%AD%E6%96%87.txt and attachment link were unable to locate this file.
Attachments (0)
Change History (12)
comment:1 by , 20 years ago
| Keywords: | attachment unicode added | 
|---|---|
| Milestone: | → 0.10 | 
| Owner: | changed from to | 
comment:2 by , 20 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
thanks, r3103 is now working with asian filenames.
comment:3 by , 19 years ago
| Keywords: | windows added | 
|---|---|
| Resolution: | fixed | 
| Status: | closed → reopened | 
attachement problem
- Trac 0.10dev(revision 3416) on Windows XP
 - korean filename: example) 한글.txt
 
error message
Traceback (most recent call last):
  File "C:\Python23\Lib\site-packages\trac\web\main.py", line 314, in dispatch_request
    dispatcher.dispatch(req)
  File "C:\Python23\Lib\site-packages\trac\web\main.py", line 163, in dispatch
    if not req.path_info or req.path_info == '/':
  File "C:\Python23\Lib\site-packages\trac\web\api.py", line 193, in <lambda>
    path_info = property(fget=lambda self: self.environ.get('PATH_INFO', '').decode('utf-8'),
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa2 in position 31: unexpected code byte
comment:4 by , 19 years ago
The byte 0xa2 is not in the example filename you mentioned.  I've tested the example filename on different Trac setups and it works fine.  I also tested a filename with the character for 0xa2 "¢", which works fine as well.  What web server are you using, and which Trac frontend (FastCGI, mod_python, CGI)?  It looks like it must be encoding the PATH_INFO variable incorrectly.
comment:6 by , 19 years ago
| Milestone: | 0.10 → 0.11 | 
|---|
comment:7 by , 19 years ago
| Milestone: | 0.11 | 
|---|---|
| Resolution: | → duplicate | 
| Status: | reopened → closed | 
I think it's the same issue as #3663.
follow-up: 9 comment:8 by , 19 years ago
| Resolution: | duplicate | 
|---|---|
| Status: | closed → reopened | 
I think that problem is in getting filename of uploaded file from request. I'm trying to upload files within ScreenshotsPlugin using this:
file = req.args['file'] filename = file.filename
The filename object is then of type str and should be of type unicode, should't it?
follow-up: 11 comment:9 by , 19 years ago
Replying to Blackhex:
I think that problem is in getting filename of uploaded file from request. I'm trying to upload files within ScreenshotsPlugin using this:
Which file/version are you refering to?
comment:10 by , 19 years ago
I traced the error to trac.web.api.Request._parse_args, and it affects both 0.10-stable and trunk. In short, non-file arguments (i.e. most of them) are decoded as UTF8 text there, but filenames are left alone. These should be decoded as well.
comment:11 by , 19 years ago
comment:12 by , 18 years ago
| Resolution: | → worksforme | 
|---|---|
| Status: | reopened → closed | 
I can't reproduce this issue with the latest trunk, using tracd on a Mac OS 10.4.10. I tried with the same machine as the client (OmniWeb/WebKit), as well as with a virtualized Linux/Ubuntu 7.04 (Firefox 2.0.0.3), using the proposed korean 한글.txt and chinese(?) 中文.txt filenames.



  
While trying out with european accented characters on Windows, I also had some issues, but different ones. I've fixed them in r3103.
Can you test if this works for asian characters too?