Modify

Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#11145 closed defect (fixed)

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2192' in position 868: ordinal not in range(128)

Reported by: rjollos Owned by: rjollos
Priority: normal Component: TracHacksPlugin
Severity: normal Keywords: genshi 0.7
Cc: hasienda Trac Release: 1.0

Description

An error results when placing the [[ListHacks]] on WikiStart:

2013-06-06 09:38:22,343 Trac[formatter] ERROR: Macro ListHacks(None) failed:
Traceback (most recent call last):
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 765, in _macro_formatter
    return macro.ensure_inline(macro.process(args))
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 356, in process
    text = self.processor(text)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/wiki/formatter.py", line 343, in _macro_processor
    text)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracHacks-2.0-py2.6.egg/trachacks/web_ui.py", line 836, in expand_macro
    output = "%s%s\n" % (output, fieldset)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/Genshi-0.7-py2.6-linux-i686.egg/genshi/builder.py", line 107, in __str__
    return str(self.generate())
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2192' in position 868: ordinal not in range(128)

Attachments (0)

Change History (4)

comment:1 Changed 15 months ago by rjollos

  • Reporter changed from anonymous to rjollos

comment:2 Changed 15 months ago by rjollos

  • Keywords genshi 0.7 added
  • Status changed from new to assigned

I pulled down the Trac environment and database and couldn't reproduce the issue at first. That was because I setup the environment with Genshi 0.6, but we are running 0.7 on the server. After I upgraded my development environment to Genshi 0.7, I saw the same error as we see on the server.

I think the issue is essentially the same as #10989. The ListHacks macro is doing string formatting to a plain old string in order to join content together.

comment:3 Changed 15 months ago by rjollos

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

In 13270:

Fixes #11145: Resolved a UnicodeEncodeError in Genshi 0.7 by not formatting the markup to a string.

comment:4 Changed 15 months ago by rjollos

#11133 led to the finding of a similar fix in Trac, [t 11683], providing confidence that [13270] is the proper fix. It appears that we could have just appended a u to each string, but using builder.tag seems to result in cleaner code.

Add Comment

Modify Ticket

Action
as closed .
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.