Edgewall Software

Ticket #5778 (closed defect: fixed)

Opened 18 months ago

Last modified 15 months ago

Codepages bug in macros

Reported by: OXIj Owned by: cboos
Priority: low Milestone: 0.11
Component: wiki system Version:
Severity: trivial Keywords: unicode datetime locale
Cc:

Description

Example macro fails with unicode error on Russian UTF-8 locale.

class TimestampMacro(WikiMacroBase):
    """Inserts the current time (in seconds) into the wiki page."""

    def expand_macro(self, formatter, name, args):
        t = time.localtime()
        return tag.b(time.strftime('%c', t))

this code resolved the problem:

class TimestampMacro(WikiMacroBase):
    """Inserts the current time (in seconds) into the wiki page."""

    def expand_macro(self, formatter, name, args):
        t = time.localtime()
        return tag.b(unicode(time.strftime('%c', t), "utf-8"))

but it shold be written better (with locale checking), and some other macros may have this bug too

Attachments

Change History

Changed 17 months ago by cboos

  • milestone set to 0.11.1

Ok, to_unicode should be used there.

Changed 15 months ago by cboos

  • keywords datetime locale added
  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from 0.11.1 to 0.11

The fix was slightly more involved and lead me to find a problem with the datefmt.format_datetime utility, see r6113.

Add/Change #5778 (Codepages bug in macros)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.