Opened 17 years ago
Closed 17 years ago
#1969 closed defect (fixed)
ascii codec can't encode character
Reported by: | anonymous | Owned by: | Colin Guthrie |
---|---|---|---|
Priority: | normal | Component: | WorkLogPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
When trying to click "stop work" with comment supplied, the following is thrown:
Traceback (most recent call last): File "/var/lib/python-support/python2.4/trac/web/main.py", line 406, in dispatch_request dispatcher.dispatch(req) File "/var/lib/python-support/python2.4/trac/web/main.py", line 237, in dispatch resp = chosen_handler.process_request(req) File "build/bdist.linux-i686/egg/worklog/webui.py", line 160, in process_request UnicodeEncodeError: 'ascii' codec can't encode character u'\u0142' in position 20: ordinal not in range(128)
The error occurs, when I use characters specific to iso-8859-2 (above codes 127).
I'm new to Trac and Python, so can't help too much, sorry. Maybe this solution will help?
Attachments (1)
Change History (5)
comment:1 Changed 17 years ago by
comment:2 Changed 17 years ago by
Trac Release: | 0.10 → 0.11 |
---|
The patch above fixes this issue for me with a current SVN checkout of WorkLogPlugin and Trac 0.11b1.
It seems that the comment in the HTTP request is encoded in UTF-8, so trying to str()
that would definitely fail. Leaving it encoded seems to give correct results, so apparently the processing chain assumes UTF-8 encoded strings all the way.
I'm not familiar with Trac internals, so this might break things on other setups.
comment:3 Changed 17 years ago by
I just verified that the patch above works correctly also against [3075].
I haven't found any negative side effects for this patch. I'm using it on ~10 trac sites (admittedly all with a very similar configuration) for four weeks now.
I'd appreciate having this committed, since currently the plugin has to be patched on every svn update to make accented letters and unicode symbols work in stop comments.
comment:4 Changed 17 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
I think you've hit the nail on the head with your analysis of the problem. I'll try to take a look sometime soon.