Ticket #64 (new defect)

Opened 3 years ago

Last modified 2 years ago

utf-8 output not enforced

Reported by: ronin_hun@freemail.hu Assigned to: mgood
Priority: normal Component: WikiCalendarMacro
Severity: normal Keywords:
Cc: Trac Release: 0.8

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/21/05 21:43:28.
proposed patch

Change History

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

  • attachment WikiCalendar.py.patch added.

proposed patch

10/21/05 21: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 08:35:23 changed by athomas

  • milestone deleted.

Milestone 0.9 deleted

06/26/06 22: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 09: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.


Add/Change #64 (utf-8 output not enforced)




Change Properties
Action