Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

#8868 closed defect (worksforme)

Unicode problem in ticket/report.py: UnicodeDecodeError: 'ascii' codec can't decode byte

Reported by: chris+trac@… Owned by:
Priority: normal Milestone:
Component: report system Version: none
Severity: normal Keywords: unicode needinfo
Cc: chris+tracwiki@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Using 0.11-2 on Ubuntu 8.10, accessing http://rita.wfplogistics.org/trac/report/1:

Trac detected an internal error:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 21: ordinal not in range(128)

File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 423, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 197, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.5/site-packages/trac/ticket/report.py", line 105, in process_request
  template, data, content_type = self._render_view(req, db, id)
File "/usr/lib/python2.5/site-packages/trac/ticket/report.py", line 409, in _render_view
  value = unicode(result[col_idx])

Having seen tickets #6352, #6535, #3908, #7959, I decided to try changing the referenced line in report.py to use to_unicode() instead of unicode(), and it worked: the report now runs OK.

I notice that this line still there: source:/trunk/trac/ticket/report.py#L448

Attachments (0)

Change History (3)

comment:1 by Christian Boos, 15 years ago

Component: generalreport system
Keywords: needinfo added; internationa i18n report encoding UnicodeDecodeError removed

Well, that unicode() call on line 448 is only there to convert scalar values into strings. If the column content is actually a str which can't be converted to unicode, then it's already too late: the db layer should have provided us with an unicode object.

I believe there were such problems with the MySQL backend, which have been fixed since 0.11 (r7286), so you should upgrade (and have a look at MySqlDb#Collationfromwhatevertoutf8_bin as well).

comment:2 by Chris Wilson <chris+tracwiki@…>, 15 years ago

Hi cboos,

I made the database changes suggested on that page, but they don't appear to have solved the problem.

I don't wish to upgrade to the latest version as I'm using the default distribution that came with Ubuntu 8.10, this is a production system, and as it requires installation it would be hard to get the system back into its original state, and I can't afford that time when my workaround above makes trac usable for me.

Cheers, Chris.

comment:3 by Christian Boos, 15 years ago

Resolution: worksforme
Status: newclosed

I hope you didn't mess up your system then, as the need to change the collation had to go together with the upgrade, as the page says (… since 0.11.1). But well, it's just for the collation, the base type remains utf8 in both cases.

If someone faces this issue with a version more recent than 0.11, please reopen (but I doubt this can happen).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.