Opened 16 years ago

Closed 15 years ago

Last modified 13 months ago

#766 closed defect (fixed)

AddComment does not manage Unicode strings

Reported by: anonymous Owned by: Alec Thomas
Priority: normal Component: AddCommentMacro
Severity: normal Keywords: unicode
Cc: Trac Release: 0.10


In new version of trac 0.10 the management of strings have changed. Now the unicode python class is used. AddComment needs to be updated.

More info:

Attachments (1)

AddComment-utf8.patch (1.1 KB) - added by Tonin 15 years ago.
UTF-8 patch

Download all attachments as: .zip

Change History (6)

comment:1 Changed 16 years ago by anonymous

Error messages:

Error: Macro AddComment(None) failed

asciió01ordinal not in range(128)

and in trac-env/log/trac.log: {{{2006-10-05 10:30:30,821 Trac[formatter] ERROR: Macro AddComment(None) failed Traceback (most recent call last):

File "/var/lib/python-support/python2.3/trac/wiki/", line 439, in _macro_formatter

return macro.process(self.req, args, True)

File "/var/lib/python-support/python2.3/trac/wiki/", line 112, in process

text = self.processor(req, text)

File "/var/lib/python-support/python2.3/trac/wiki/", line 100, in _macro_processor

return self.macro_provider.render_macro(req,, text)

File "/var/lib/python-support/python2.3/trac/wiki/", line 453, in render_macro

return module.execute(req and req.hdf, content, self.env)

File "/var/lib/trac/projects/sistemas/wiki-macros/", line 39, in execute

comment = Markup(hdf.getValue("args.addcomment", "")).unescape()

File "/var/lib/python-support/python2.3/trac/util/", line 46, in new

return, text)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128) }}}

comment:2 Changed 16 years ago by anonymous

Workaround: If you use utf-8, substitute the following line:

comment = Markup(hdf.getValue("args.addcomment", "")).unescape()


comment = Markup(unicode(hdf.getValue("args.addcomment", ""), 'utf-8')).unescape()

comment:3 Changed 15 years ago by anonymous

Correction also needs to be done on the authname and authoraddcomment values.

See patched attached.

Changed 15 years ago by Tonin

Attachment: AddComment-utf8.patch added

UTF-8 patch

comment:4 Changed 15 years ago by osimons

Resolution: fixed
Status: newclosed

(In [2817]) AddCommentMacro: Fixing some unicode issues with 0.10 version.

Fixes #766

comment:5 Changed 13 months ago by Ryan J Ollos

Keywords: 0.10 removed

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Alec Thomas.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

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

Note: See TracTickets for help on using tickets.