Opened 16 months ago

Closed 15 months ago

Last modified 14 months ago

#10989 closed defect (fixed)

UnicodeEncodeError with Genshi 0.7

Reported by: ykrocku@… Owned by: falkb
Priority: high Component: SimpleMultiProjectPlugin
Severity: critical Keywords: genshi 0.7
Cc: Trac Release: 1.0


Error callstack

Trac detected an internal error:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 227-230: ordinal not in range(128)

Most recent call last:
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/", line 497, in _dispatch_request
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/", line 233, in dispatch
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/", line 983, in render_template
  stream |= self._filter_stream(req, method, filename, stream, data)
File "/usr/local/lib/python2.7/dist-packages/Genshi-0.7-py2.7-linux-i686.egg/genshi/", line 133, in __or__
  return Stream(_ensure(function(self)), serializer=self.serializer)
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/", line 1162, in inner
File "/usr/local/lib/python2.7/dist-packages/SimpleMultiProject-0.0.3dev-py2.7.egg/simplemultiproject/", line 195, in filter_stream
  div_milestones_array = self.__extract_div_milestones_array('<div class="milestone">',stream_milestones)
File "/usr/local/lib/python2.7/dist-packages/SimpleMultiProject-0.0.3dev-py2.7.egg/simplemultiproject/", line 108, in __extract_div_milestones_array
  html_milestones = str(stream_milestones)

I believe this error is caused by this changeset

I try to call stream_milestones.render() instead of str(stream_milestones)

html_milestones = str(stream_milestones)
html_milestones = stream_milestones.render()

And this fix this probelm

System Information

Package	Version
Trac	1.0.1
Babel	0.9.6
Docutils	0.7
Genshi	0.7 (without speedups)
mod_wsgi	3.3 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
Pygments	1.4
pysqlite	2.6.0
Python	2.7.2+ (default, Oct 4 2011, 20:29:37) [GCC 4.6.1]
pytz	2010b
setuptools	0.6
SQLite	3.7.7
Subversion	1.6.12 (r955767)
jQuery	1.7.2

Attachments (0)

Change History (6)

comment:1 Changed 15 months ago by falkb

  • Owner changed from crossroad to falkb

comment:2 Changed 15 months ago by falkb

  • Status changed from new to assigned

Thanks. Applying this patch it still works for me, too. My question is to you: Is render() available for older versions or could it break something?

comment:3 Changed 15 months ago by rjollos

I think you should be okay to call render:

comment:4 Changed 15 months ago by falkb

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

(In [13138]) Fixed #10989: call render() instead of str() in extract_div_milestones_array() to avoid UnicodeEncodeError (Thanks to ykrocku for the patch and rjollos for reviewing)

Version 0, edited 15 months ago by falkb (next)

comment:5 Changed 14 months ago by rjollos

  • Keywords genshi 0.7 added

Similar issue in #11145.

comment:6 Changed 14 months ago by rjollos

Similar issue in #11133.

Add Comment

Modify Ticket

as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from falkb. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.