Modify

Opened 7 years ago

Closed 7 years ago

#1969 closed defect (fixed)

ascii codec can't encode character

Reported by: anonymous Owned by: coling
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)

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

Download all attachments as: .zip

Change History (5)

comment:1 Changed 7 years ago by coling

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 7 years ago by akaihola

fix for r2741, trac 0.11 version

comment:2 Changed 7 years ago by akaihola

  • Trac Release changed from 0.10 to 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 7 years ago by akaihola

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 7 years ago by coling

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Action
as closed The owner will remain coling.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.