Ticket #5778 (closed defect: fixed)
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
Note: See
TracTickets for help on using
tickets.


