Ticket #64 (closed defect: fixed)

Opened 8 years ago

Last modified 2 months ago

[Patch] utf-8 output not enforced

Reported by: ronin_hun@freemail.hu Assigned to: hasienda
Priority: normal Component: WikiCalendarMacro
Severity: normal Keywords: unicode
Cc: rjollos Trac Release: 0.12

Description

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

WikiCalendar.py.patch (0.5 kB) - added by ronin_hun@freemail.hu on 10/22/05 04:43:28.
proposed patch

Change History

10/22/05 04:43:28 changed by ronin_hun@freemail.hu

  • attachment WikiCalendar.py.patch added.

proposed patch

10/22/05 04:46:14 changed by ronin_hun@freemail.hu

Maybe it would be better to use

    locale.nl_langinfo(locale.CODESET)

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

01/09/06 15:35:23 changed by athomas

  • milestone deleted.

Milestone 0.9 deleted

06/27/06 05:58:02 changed by zhigang@yi-dao.com

  • 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) 
    buff.write('</tr></thead>\n<tbody>\n') 

06/27/06 16:37:45 changed 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.

10/30/09 04:46:26 changed by rjollos

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

12/31/09 22:59:13 changed by rjollos

  • owner changed from mgood to rjollos.

01/13/10 22:22:05 changed by rjollos

  • status changed from new to assigned.

02/03/10 03:26:42 changed by anonymous

  • release changed from 0.8 to 0.11.

08/28/10 14:02:14 changed by hasienda

  • keywords set to unicode.

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.

08/30/10 07:07:33 changed by rjollos

  • status changed from assigned to new.
  • owner changed from rjollos to hasienda.
  • cc set to rjollos.

12/13/10 02:02:39 changed 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.

04/16/11 21:58:32 changed by ronin_hun@freemail.hu

  • release changed from 0.11 to 0.12.
  • status changed from new to closed.
  • resolution set to fixed.

Sorry I've been without internet for a while.

Seems fine now after a quick test.

04/16/11 22:32:34 changed by hasienda

  • status changed from closed to reopened.
  • resolution deleted.

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.

03/30/13 12:32:55 changed by hasienda

  • status changed from reopened to closed.
  • resolution set to fixed.

(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/Change #64 ([Patch] utf-8 output not enforced)




Change Properties
Action