Edgewall Software
Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10678 closed defect (fixed)

UnicodeEncodeError while unicode digits as numbered list in wiki

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 0.12.4
Component: wiki system Version: 0.12-stable
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

If the following text is in comment of ticket page, UnicodeEncodeError is logged in trac.log.

 ①. circled digit one

The error;

...
  File "home/jun66j5/venv/trac-0.12/lib/python2.4/site-packages/trac/wiki/formatter.py", line 1161, in replace
  File "home/jun66j5/venv/trac-0.12/lib/python2.4/site-packages/trac/wiki/formatter.py", line 1157, in handle_match
  File "home/jun66j5/venv/trac-0.12/lib/python2.4/site-packages/trac/wiki/formatter.py", line 801, in _list_formatter
UnicodeEncodeError: 'decimal' codec can't encode character u'\u2460' in position 0: invalid decimal Unicode string

Wiki parser uses \d with re.UNICODE and the regexp matches unicode digits, however a subset of these characters cannot be convert with int().

I don't think it expects to match unicode digits. unicode-digits-wiki-list.diff uses [0-9] instead.

Attachments (1)

unicode-digits-wiki-list.diff (1.4 KB ) - added by Jun Omae 12 years ago.

Download all attachments as: .zip

Change History (12)

by Jun Omae, 12 years ago

in reply to:  description ; comment:1 by Christian Boos, 12 years ago

Looks good!


[OT] Btw, tell me if you'd like to get a jomae.git on t.e.o. like the cboos.git I added for me.

I was lately thinking about creating a plugin which would add an "Attach branch" button next to "Attach file" in tickets, as a way to avoid having to go through patches…

comment:2 by Jordi Mallach, 12 years ago

Just lurking around: the comments in the test part of the patch seem to be missing a verb:

Unicode digits will not start a numbered list?

comment:3 by Remy Blank, 12 years ago

I wonder if we have more occurrences of this issue (i.e. using \d in a regexp, and converting the resulting match using int()).

comment:4 by Jun Omae, 12 years ago

I just looked into the source about the same occurrences, again. Then I cannot find. However, \d with re.UNICODE occurs the similar issues.

Wiki system should not convert the following text to Trac links.

{④②} #①-④② #T①-④② [④②] r④② changeset:④② [①-④②] log:@①-④②

I'll work the new issue later.

in reply to:  1 ; comment:5 by Jun Omae, 12 years ago

Replying to cboos:

[OT] Btw, tell me if you'd like to get a jomae.git on t.e.o. like the cboos.git I added for me.

Great! Would you create jomae.git repository for me?

I was lately thinking about creating a plugin which would add an "Attach branch" button next to "Attach file" in tickets, as a way to avoid having to go through patches…

Nice idea!

in reply to:  5 comment:6 by Christian Boos, 12 years ago

Replying to jomae:

Replying to cboos:

[OT] Btw, tell me if you'd like to get a jomae.git on t.e.o. like the cboos.git I added for me.

Great! Would you create jomae.git repository for me?

Done. See TracTeam/Repositories#git for details.

Last edited 12 years ago by Christian Boos (previous) (diff)

comment:7 by Remy Blank, 12 years ago

Jun, would it make sense to apply this patch to 0.12-stable now, and to merge it in time for 1.0?

in reply to:  7 comment:8 by Jun Omae, 12 years ago

Replying to rblank:

Jun, would it make sense to apply this patch to 0.12-stable now, and to merge it in time for 1.0?

I've reworked about the cases in comment:4. repos:jomae.git:ticket10678/0.12-stable and repos:jomae.git:ticket10678/trunk for 1.0.

Ok to apply?

comment:9 by Remy Blank, 12 years ago

Looks great, please go ahead.

comment:10 by Jun Omae, 12 years ago

Resolution: fixed
Status: newclosed

Applied in [11092] and merged in [11093].

comment:11 by Jun Omae, 12 years ago

Owner: set to Jun Omae

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.