Opened 19 years ago
Closed 12 years ago
#64 closed defect (fixed)
[Patch] utf-8 output not enforced
Reported by: | Owned by: | Steffen Hoffmann | |
---|---|---|---|
Priority: | normal | Component: | WikiCalendarMacro |
Severity: | normal | Keywords: | unicode |
Cc: | Ryan J Ollos | 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 (1)
Change History (15)
Changed 19 years ago by
Attachment: | WikiCalendar.py.patch added |
---|
comment:1 Changed 19 years ago by
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).
comment:3 Changed 18 years ago by
Trac Release: | → 0.8 |
---|
# prev month link prevMonthURL = thispageURL+'?month=%d&year=%d' % (prevMonth, prevYear) buff.write('<a href="%s">< </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"> ></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')
comment:4 Changed 18 years ago by
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 15 years ago by
Summary: | utf-8 output not enforced → [Patch] utf-8 output not enforced |
---|
comment:6 Changed 15 years ago by
Owner: | changed from Matt Good to Ryan J Ollos |
---|
comment:7 Changed 15 years ago by
Status: | new → assigned |
---|
comment:8 Changed 15 years ago by
Trac Release: | 0.8 → 0.11 |
---|
comment:9 Changed 14 years ago by
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 14 years ago by
Cc: | Ryan J Ollos added; anonymous removed |
---|---|
Owner: | changed from Ryan J Ollos to Steffen Hoffmann |
Status: | assigned → new |
comment:11 Changed 14 years ago by
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 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Trac Release: | 0.11 → 0.12 |
Sorry I've been without internet for a while.
Seems fine now after a quick test.
comment:13 Changed 14 years ago by
Resolution: | fixed |
---|---|
Status: | closed → 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 12 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → 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.
proposed patch