Opened 11 years ago

Closed 10 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


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/", line 406, in dispatch_request
  File "/var/lib/python-support/python2.4/trac/web/", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-i686/egg/worklog/", 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)

worklog-#1969-fix.diff (494 bytes) - added by Antti Kaihola 10 years ago.
fix for r2741, trac 0.11 version

Download all attachments as: .zip

Change History (5)

comment:1 Changed 11 years ago by Colin Guthrie

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.

Changed 10 years ago by Antti Kaihola

Attachment: worklog-#1969-fix.diff added

fix for r2741, trac 0.11 version

comment:2 Changed 10 years ago by Antti Kaihola

Trac Release: 0.100.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 10 years ago by Antti Kaihola

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 10 years ago by Colin Guthrie

Resolution: fixed
Status: newclosed

(In [3147]) Closes #1969 by applying patch by akaihola. Thanks for this and sorry I didn't commit it earlier :)

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Colin Guthrie.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.