Modify

Opened 18 years ago

Closed 16 years ago

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

Description

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 17 years ago.
UTF-8 patch

Download all attachments as: .zip

Change History (6)

comment:1 Changed 18 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/formatter.py", line 439, in _macro_formatter

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

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

text = self.processor(req, text)

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

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

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

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

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

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

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

return unicode.new(self, text)

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

comment:2 Changed 18 years ago by anonymous

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

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

by

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

comment:3 Changed 17 years ago by anonymous

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

See patched attached.

Changed 17 years ago by Tonin

Attachment: AddComment-utf8.patch added

UTF-8 patch

comment:4 Changed 16 years ago by osimons

Resolution: fixed
Status: newclosed

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

Fixes #766

comment:5 Changed 3 years ago by Ryan J Ollos

Keywords: 0.10 removed

Modify Ticket

Change Properties
Set your email in Preferences
Action
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.