Modify

Opened 8 years ago

Closed 7 years ago

Last modified 6 years ago

#766 closed defect (fixed)

AddComment does not manage Unicode strings

Reported by: anonymous Owned by: athomas
Priority: normal Component: AddCommentMacro
Severity: normal Keywords: unicode, 0.10
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 8 years ago.
UTF-8 patch

Download all attachments as: .zip

Change History (5)

comment:1 Changed 8 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 8 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 8 years ago by anonymous

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

See patched attached.

Changed 8 years ago by tonin

UTF-8 patch

comment:4 Changed 7 years ago by osimons

  • Resolution set to fixed
  • Status changed from new to closed

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

Fixes #766

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.