Opened 11 years ago

Closed 4 years ago

#64 closed defect (fixed)

[Patch] utf-8 output not enforced

Reported by: ronin_hun@… Owned by: hasienda
Priority: normal Component: WikiCalendarMacro
Severity: normal Keywords: unicode
Cc: rjollos Trac Release: 0.12


Maybe I am missing something, but it seems to me that utf8 output is not enforced, and trac uses utf-8 output only (as of 0.9b2). So if the system's locale encoding is set to e.g.: LATIN2 (iso8859_2), then on the wikipage we see unknown characters represented as "?", because the time.strftime() with %B returns locale specific characters in the locale's encoding.

example: "october" in my language with latin2 (default encoding) is "október" (chr 162, 0xf3 in unicode)

I am not familiar with python, so I could only solve this by replacing the return statement with

    return unicode(table, "iso8859_2").encode("utf8")

but that isn't universal solution, because for Japanese I have to write

    return unicode(table, "shift_jis").encode("utf8")

Attachments (1) (543 bytes) - added by ronin_hun@… 11 years ago.
proposed patch

Download all attachments as: .zip

Change History (15)

Changed 11 years ago by ronin_hun@…

proposed patch

comment:1 Changed 11 years ago by ronin_hun@…

Maybe it would be better to use


but as I see that isn't supported in windows (at least in python2.3).

comment:2 Changed 11 years ago by athomas

  • milestone 0.9 deleted

Milestone 0.9 deleted

comment:3 Changed 11 years ago by zhigang@…

  • Trac Release set to 0.8
    # prev month link 
    prevMonthURL = thispageURL+'?month=%d&year=%d' % (prevMonth, prevYear) 
    buff.write('<a href="%s">&lt; </a>' % prevMonthURL) 
    # the caption 
    # buff.write(time.strftime('%B %Y', tuple(date)))
    buff.write(time.strftime('%m %Y', tuple(date))) 
    # next month link 
    nextMonthURL = thispageURL+'?month=%d&year=%d' % (nextMonth, nextYear) 
    buff.write('<a href="%s"> &gt;</a>' % nextMonthURL) 
    buff.write('</caption>\n<thead><tr align="center">') 
    #for day in calendar.weekheader(2).split():
    weekheaders = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su']
    for day in weekheaders: 
        buff.write('<th scope="col">%s</th>' % day) 

comment:4 Changed 11 years ago by mgood

Can you explain that last block of code? I don't think hardcoding the week days is really the way to go here.

comment:5 Changed 7 years ago by rjollos

  • Summary changed from utf-8 output not enforced to [Patch] utf-8 output not enforced

comment:6 Changed 7 years ago by rjollos

  • Owner changed from mgood to rjollos

comment:7 Changed 7 years ago by rjollos

  • Status changed from new to assigned

comment:8 Changed 7 years ago by anonymous

  • Trac Release changed from 0.8 to 0.11

comment:9 Changed 6 years ago by hasienda

  • Keywords unicode added

There has been done considerably efforts to improve the 'sister' plugin WikiTicketCalendarMacro.

With regards to #7564 I'd appreciate, if you could test your issue with the current version of WikiTicketCalendarMacro as well and report back here. I can't make promises, but this might be a big step towards finally solving this issue. Thanks for your patience and for still taking care.

comment:10 Changed 6 years ago by rjollos

  • Cc rjollos added; anonymous removed
  • Owner changed from rjollos to hasienda
  • Status changed from assigned to new

comment:11 Changed 6 years ago by hasienda

Ping. Ronin, would you please test the WikiTicketCalendarMacro in current WikiCalendarMacro trunk.

This has a lot of unicode related fixes, and WikiCalendarMacro will be integrated there too very soon, so this would help me a lot to get this issue resolved for you and me. Thank you in advance for taking your time for testing.

comment:12 Changed 6 years ago by ronin_hun@…

  • Resolution set to fixed
  • Status changed from new to closed
  • Trac Release changed from 0.11 to 0.12

Sorry I've been without internet for a while.

Seems fine now after a quick test.

comment:13 Changed 6 years ago by hasienda

  • Resolution fixed deleted
  • Status changed from closed to reopened

Your feedback is most appreciated, even more as it is positive.

Anyway, let's keep this ticket open to remind me, that actual code merge will definitely solve the issues related to (insufficient) Unicode encoding previously spotted with this plugin.

comment:14 Changed 4 years ago by hasienda

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

(In [12842]) WikiCalendarMacro: Releasing current, tested macro package as final product, closes #64, #578, #6636, #7564, #7653, #8818, #9568, #9718 and #9719.

After a long time one of the oldest Trac hacks (see changeset [53]) is united with its ambitious fork WikiTicketCalendarMacro for convenience. While maintaining separate wiki pages for both macros, upstream development continues together in the source:wikicalendarmacro/trunk branch.

Add Comment

Modify Ticket

as closed The owner will remain hasienda.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.