Modify ↓
Opened 17 years ago
Closed 17 years ago
#5778 closed defect (fixed)
Codepages bug in macros
Reported by: | OXIj | Owned by: | Christian Boos |
---|---|---|---|
Priority: | low | Milestone: | 0.11 |
Component: | wiki system | Version: | |
Severity: | trivial | Keywords: | unicode datetime locale |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
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 (0)
Change History (2)
comment:1 by , 17 years ago
Milestone: | → 0.11.1 |
---|
comment:2 by , 17 years ago
Keywords: | datetime locale added |
---|---|
Milestone: | 0.11.1 → 0.11 |
Resolution: | → fixed |
Status: | new → closed |
The fix was slightly more involved and lead me to find a problem with the datefmt.format_datetime
utility, see r6113.
Note:
See TracTickets
for help on using tickets.
Ok,
to_unicode
should be used there.