Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

#12490 closed defect (fixed)

Genshi UnicodeEncodeError due to a comment link with unicode digits

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0.12
Component: ticket system Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fix UnicodeEncodeError due to a comment link with unicode digits

API Changes:
Internal Changes:

Description

I get a Genshi UnicodeEncodeError while adding comment like comment:123④.

10:32:01 AM Trac[main] WARNING: [192.168.11.11] HTTPInternalError: 500 Trac Error (Genshi UnicodeEncodeError error while rendering template wiki_view.html (unknown template location))

After use_chunked_encoding = true, stacetrace of the error is logged:

...
  File "/venv/py27-1.0/local/lib/python2.7/site-packages/genshi/template/eval.py", line 178, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "/src/tracdev/git/trac/ticket/templates/ticket_change.html", line 143, in <Expression u'wiki_to_html(context, change.comment, escape_newlines=preserve_newlines)'>
    ${wiki_to_html(context, change.comment, escape_newlines=preserve_newlines)}
  File "/src/tracdev/git/trac/wiki/formatter.py", line 1586, in format_to_html
    return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
  File "/src/tracdev/git/trac/wiki/formatter.py", line 1541, in generate
    escape_newlines)
  File "/src/tracdev/git/trac/wiki/formatter.py", line 1323, in format
    result = re.sub(self.wikiparser.rules, self.replace, line)
  File "/venv/py27-1.0/lib/python2.7/re.py", line 151, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/src/tracdev/git/trac/wiki/formatter.py", line 1241, in replace
    replacement = self.handle_match(fullmatch)
  File "/src/tracdev/git/trac/wiki/formatter.py", line 1237, in handle_match
    return internal_handler(match, fullmatch)
  File "/src/tracdev/git/trac/wiki/formatter.py", line 611, in _shref_formatter
    return self._make_link(ns, target, match, match, fullmatch)
  File "/src/tracdev/git/trac/wiki/formatter.py", line 664, in _make_link
    return resolver(self, ns, target, escape(label, False))
  File "/src/tracdev/git/trac/ticket/api.py", line 528, in _format_comment_link
    if cnum != 'description' and not ticket.get_change(cnum):
  File "/src/tracdev/git/trac/ticket/model.py", line 451, in get_change
    row = self._find_change(cnum)
  File "/src/tracdev/git/trac/ticket/model.py", line 645, in _find_change
    scnum = str(cnum)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2463' in position 3: ordinal not in range(128)

Attachments (0)

Change History (3)

comment:1 by Jun Omae, 8 years ago

Proposed changes in log:jomae.git@t12490.

comment:2 by Jun Omae, 8 years ago

Owner: set to Jun Omae
Status: newassigned

comment:3 by Jun Omae, 8 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [14845] and merged to trunk in [14846].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae 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.