Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#6890 closed defect (fixed)

MacroList can't display with non-ascii(i.e. Japanese) characters.

Reported by: takayama <support@…> Owned by: osimons
Priority: normal Milestone: 0.11
Component: wiki system Version: 0.11b1
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I tried to fix it, and here is the patch for source:trunk/trac/wiki/macros.py@6472

  • macros.

    old new  
    460460        if content and macro_name != content:
    461461            continue
    462462        try:
    463             descr = macro_provider.get_macro_description(macro_name)
     463            descr = unicode(macro_provider.get_macro_description(macro_name), 'utf-8')
    464464            descr = format_to_html(self.env, formatter.context,
    465465                                   descr or '')
    466466        except Exception, e:

Attachments (0)

Change History (3)

comment:1 by osimons, 17 years ago

Component: i18nwiki
Milestone: 0.11.1
Owner: changed from Christopher Lenz to osimons

Basically it is the responisbility of the macro to provide a unicode string as this can be used for many purposes other than just the [[MacroList]] macro.

Here is a patch for the Trac default macros that I'll commit - it will fix it if the macro you use inherits from WikiMacroBase, and for others it will illustrate the explicity need to return unicode:

  • trac/wiki/macros.py

     
    2929from trac.util.datefmt import format_date, utc
    3030from trac.util.compat import sorted, groupby, any, set
    3131from trac.util.html import escape
    32 from trac.util.text import unquote
     32from trac.util.text import unquote, to_unicode
    3333from trac.util.translation import _
    3434from trac.wiki.api import IWikiMacroProvider, WikiSystem, parse_args
    3535from trac.wiki.formatter import format_to_html, format_to_oneliner, \
     
    5353
    5454    def get_macro_description(self, name):
    5555        """Return the subclass's docstring."""
    56         return inspect.getdoc(self.__class__)
     56        return to_unicode(inspect.getdoc(self.__class__))
    5757
    5858    def parse_macro(self, parser, name, content):
    5959        raise NotImplementedError

If your problematic macro inherits from WikiMacroBase, you could perhaps also verify the patch before I commit?

in reply to:  1 comment:2 by takayama <support@…>, 17 years ago

Replying to osimons:

Thanks osimons.

OK. I patched it and use !MacroList macro.

So, It completely worked.

Now you can commit it. Thank you!

comment:3 by osimons, 17 years ago

Milestone: 0.11.10.11
Resolution: fixed
Status: newclosed

Committed in [6612].

Modify Ticket

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