Opened 4 years ago

Closed 4 years ago

Last modified 3 years 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


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/", line 765, in _macro_formatter
    return macro.ensure_inline(macro.process(args))
  File "/srv/", line 356, in process
    text = self.processor(text)
  File "/srv/", line 343, in _macro_processor
  File "/srv/", line 836, in expand_macro
    output = "%s%s\n" % (output, fieldset)
  File "/srv/", 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 4 years ago by rjollos

  • Reporter changed from anonymous to rjollos

comment:2 Changed 4 years 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 4 years 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 3 years 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

as closed The owner will remain rjollos.
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.